Tag Archives: mime

Which is better: to embed images or link images in HTML emails?

Early this morning, and later in the evening, I was working on a PHP script that composes HTML emails with extra files included, but rather than making images as attachments, the script embeds the images so they don’t actually appear as attachments, but appear instantly within the email.

It works fine for <img> tags, but the big issue comes when trying to use CSS.

<img src=”cid:20110212231111.1we615e” />

This works in Thunderbird, immediately.  And it works in Gmail’s web-interface.

body { background-image: url(cid:20110212231111.1we615e); }

This DOES NOT work in Thunderibrd, and NOT in Gmail’s web interface.  These items do however appear as attachments.  So that defeats the purpose of having everything appear instantly and properly.

And given client demands, I need to make everything as perfectly seamless AND painless as possible.

So, I believe I’m going to simply link ALL images.  That will save on bandwidth, plus any email client that has image security will simply display a link that says something sounding like “Do you want to display images in this email?”.  If the recipient clicks to say yes they want to see, then everything will appear, instead of just the <img> tags, but no background.

This is an example of the far-out strange places I go in my work.

Trying to embed and compose HTML emails is difficult on a Windows machine since Thunderbird’s only HTML composing feature is old and not updated to work with the latest version, and Outlook only works (so I’ve read) with HTML composed from within Frontpage (not going to touch that with a 10-foot pole!!).  A few days ago I created an automated emailer that attaches vCard files, and in order to do this, I had to learn about MIME boundaries, content-type, content-disposition (inline vs attachment) and a whole lot of extra stuff.  Lots of technical stuff.  In the end, I’m here wasting time figuring out embedding images, just because Gmail’s web interface doesn’t operate to the most ideal level possible.

Oh well.  So I’ll just link every image.  And that’s a wrap! … several wasted hours later.

Posted in Activities & Adventures, Technology | Tagged , , , , , , , , , | 2 Comments