I'm stuck. I can't figure out how to embed an inline graphic in a CFMAIL message. I just need a clue.
Let's see what you have so far - the answer could be right there However it doesn't sound like you have a CF problem, it seems like you have a CSS problem. In your img tag you could place style="display:inline;". However I have the feeling that may not be what you are looking for. Post what you've got thus far.
I don't believe cold fusion can do a "true" inline image. (Inline mail images that are embedded into the mail message the image it self does not sit on a server. When downloaded from the server they are renamed and displayed within the message. This is a common practice of spammers these days.) The closest I believe you will be able to get short of using a third party SMTP library is going to be linked images off a website.
Another option is to create a PDF File and then embed it in the email message. As in 1) create your document ( <cfdocument .... ) 2) Embed in your mail message (<cfmail ..... > <cfcontent ...> ) I've never actually tried it, but give it a shot, who knows. newBish - that's a good point you have. Maybe we're missing something because I'd like to think that it is possible, maybe we just don't know how - oh well - that's why were're here...to help each other out! HTH daTropics
Ive done something similar to this before and was forced to leverage the JavaMail API in a CFC to accomplish the task. Something I don't recommend for the faint of heart. It took months to get it right, I probably could have bought a third party application for under 200, and in retrospect should have.
ColdFusion can create "true" inline images in mails since CF7. You need to use the <cfmailparam> tag: <cfmail to="#yourAddress#" from="#myAddress#" subject="#subject#" type="html"> <p>This is HTML-formatted mail with<p> <img src="cid:theImg" width="350" height="263" alt="" /> <p>inline images</p> <cfmailparam file="C:\data\myfile.jpg" contentID="theImg" disposition="inline" /> </cfmail> Code (markup): The file is attached to the mail, but, displayed inline by reference to the contentID. Please note the reference to the cid: in the <img> tag's src attribute. HTH, Chris
Good to know I just found this out the yesterday while fixing an IMAP cfc I had written and thought wow ok I was wrong, I need to find that post. Good to see that some people are keeping up with what has been added in more recent versions
ile (CFMAILPARAM attribute) - This attaches a file to the email. This should be an absolute path where the actual file resides. contentid (CFMAILPARAM attribute) - An unique identifier for the attached file. This is normally used to identify the file in the mail body that references the file content. In the above example, we are using the “contentid†we provided in CFMAILPARAM tag as IMG tag cid which is the content id. Instead of providing the content id if we provide the path to the image file, then the image is sent as an attachment. Since we have used the content id, instead of being rendered as attachment, the content of the file with the id provided gets embedded into the email content. The CFMAILPARAM tag can also be used to include an image from an external link. Advantage: It will not give an impression like phishing attack or spam email. Disadvantage: It might take little more time to load the body of an email as we might have heavy images embedded.
file (CFMAILPARAM attribute) - This attaches a file to the email. This should be an absolute path where the actual file resides. contentid (CFMAILPARAM attribute) - An unique identifier for the attached file. This is normally used to identify the file in the mail body that references the file content. In the above example, we are using the “contentid†we provided in CFMAILPARAM tag as IMG tag cid which is the content id. Instead of providing the content id if we provide the path to the image file, then the image is sent as an attachment. Since we have used the content id, instead of being rendered as attachment, the content of the file with the id provided gets embedded into the email content. The CFMAILPARAM tag can also be used to include an image from an external link. Advantage: It will not give an impression like phishing attack or spam email. Disadvantage: It might take little more time to load the body of an email as we might have heavy images embedded.
Using CFMAIL tag attributes we provide all the details for sending an email programmatically like TO, FROM, MAILSERVER etc. The body of the email goes in between the starting and ending tags of CFMAIL. CFMAILPARAM (sub tag for CFMAIL) in ColdFusion is normally used to attach a file or add a header to a message. Using this tag, we can send embedded images in an email. Example Code: <cfmail to="{recipient email address}" from="{sender email address}" subject="Embedded Image Example" type="html"> <h2>Image Embed Example</h2> <p><img src="cid:img_id" width="300" height="300" alt="" /><br /></p> <!--- Embed image from the local file system ---> <cfmailparam file="{path to the image file}" contentid="img_id" /> </cfmail> Hope u find this tip interesting.
I did not know this, but apparently in ColdFusion MX 7, the CFMailParam tag can be used to embed images directly into the email content. After some initial testing, it seems this is completely true and very exciting! It is almost too easy.