|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Content ID & Images in HTML email
I'm doing the following :
Code:
<cfset logoCID = randRange(1000, 10000) & '@' & randRange(1000, 10000) />
<cfset htmlBody = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<img src=CID:#logoCID#>
<h3>HTML Mail Message</h3>
<p>This message is <strong>HTML</strong>.</p>
</body>
</html>' />
<cfset textBody = 'Some text' />
<cfmail subject="Email Test" type="multipart/related">
<cfmailpart type="text" wraptext="72">
#textBody#
</cfmailpart>
<cfmailpart type="html">
<cfmailparam file="e:\inetpub\testarea\webroot\htmlConfirmation\logo.gif" type="image/gif" disposition="attachment" contentID="#logoCID#" />
#htmlBody#
</cfmailpart>
</cfmail>
When I get the test email the Image (I'm just looking at outlook right now) isn't there... I know these options have just recently been added to <cfmailparam> but they should work, any ideas why its not? -D |
|
#2
|
|||
|
|||
|
Someone must have some experience with this... any ideas?
|
|
#3
|
|||
|
|||
|
I believe you need the image to be a valid URL that points to an image, just as you would on any web page. I haven't ever tried to embed an image into the email and am not sure how you'd go about that.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#4
|
|||
|
|||
|
I have it figured out now, so I'm sharing it incase others find this thread :
Code:
<cfset logoCID = createUUID() /> <cfmail ... type="html"> <cfmailpart type="text/html"> <h1>Test</h1> <img src=cid:#logoCID# /> </cfmailpart> <cfmailpart type="text/plain"> Some plain text </cfmailpart> <cfmailparam file="image.gif" contentid="#logoCID#" disposition="attachment" /> </cfmail> I think the key parts to mention are the type of the root <CFMAIL> function & the types of the <CFMAILPART>s Finally I found out that (outlook at least) doesn't like it when the cid in the source is in uppercase. -D |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Content ID & Images in HTML email |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|