views:

114

answers:

3

I'm working to create an HTML email which includes 2 images. Currently, I'm using tags to place the image in the email. Problem is when users get the email, it's asking the user to "click to download" for security reasons.

Is there a way to embed the image in the email, to avoid this issue?

I'm using Coldfusion to send the email.

Thanks

A: 

I am fairly certain that is an email client issue and not the email/HTML you are putting together. I am unaware (and a quick Google didn't show) of any ways to get around this with HTML.

One possible solution may be to create a rich text email instead and embed the image in the RTF, not sure if that will get you around your issue or not.

Other thought is do you have to have the images in the email? You might be better of crafting the email format to not rely on the 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 that are restricted to plain text email quite often.

confusedGeek
Why the downvote?
egrunin
Maybe someone just didn't like my answer since it doesn't give a set of steps to fix the problem. To me this is kind of like asking why can't I force the email client to display my HTML formatted email when it only supports plain text.
confusedGeek
+2  A: 

I haven't tested if this works in e-mail clients, but if you encode the image as Base64 you can include it in the HTML, which avoids the issue of connecting to a remote server.

Here's how you can do this 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>
Peter Boughton
+1  A: 

You can embed the image as an attachment using cfmailparam and link to the attachement instead of an external file.

http://www.bennadel.com/blog/61-CFMail-CFMAILPARAM-Used-to-Embed-Images-in-Email.htm

Yisroel
Problem I'm having is that the images show up as ATTACHMENTS in the email in Mac Entourage
AnApprentice