For HTML emails, how to insert images so that users don't receive an invitation to download
I am working on creating an HTML email that includes 2 images. I am currently using tags to place an image in an email. The problem is when users receive an email, it asks the user to "click to download" for security reasons.
Is there a way to insert an image into an email to avoid this problem?
I am using Coldfusion to send email.
thanks
a source to share
I have not tested if this works in email clients, but if you are encoding the image as Base64, you can include it in HTML, thus avoiding the problem of connecting to the remote server.
Here's how you can do it with CFML:
<cfset ImageFile = "/path/to/image.png" />
<cfset ImageInfo = "image/png;charset=utf-8;base64" />
<cfset ImageData = ToBase64( FileReadBinary( ImageFile ) , 'utf-8' ) />
<cfoutput>
<img src="data:#ImageInfo#,#ImageData#" alt="my picture" />
</cfoutput>
a source to share
You can embed the image as an attachment with cfmailparam
and link to the attachment instead of an external file.
http://www.bennadel.com/blog/61-CFMail-CFMAILPARAM-Used-to-Embed-Images-in-Email.htm
a source to share
I'm pretty sure this is an email issue and not the email / HTML you are piecing together. I don't know (and a quick Google didn't show) about any way to get around this with HTML.
One possible solution might be to create a rich text message instead and embed the image in RTF, but not sure if this will help you solve the problem.
Another thought: should you have images in your letter? You might be better off creating an email format to not rely on images for formatting / aesthetics, but allow them to be included if the client displays them. Not sure who your target audience is, but in my job we have to deal with users who are often extended to plain text.
a source to share