Send HTML with embedded images emails from Mail

Apr 10, '07 07:30:01AM

Contributed by: taglia

Sending HTML emails is bad, almost everyone agree on this, but in some contexts it is absolutely necessary and you do not really have a choice. Unfortunately it is the only way that I am aware of to send embedded images (i.e. screenshots, typeset mathematical formulas, etc.) to a recipient using Outlook.

Being based on WebKit, Mail is capable of editing HTML, but this option is not available by default. Officially it is only possible to compose messages using plain or rich text. The interesting thing is that Mail allows you to edit an HTML message, once you managed to put some HTML in the content. There are many ways to do that, here are three examples:

These are all valid methods to force Mail to use HTML for a message, but they are not very handy. The idea to automatize this process is very simple: use an HTML signature. If you use an HTML signature, Mail will automatically switch to HTML mode; you are free to add embedded contents (i.e. images) in the message, which will be correctly encoded and displayed in other email clients. Create an HTML signature is simple: copy and paste something from a web page in the signature box and modify it.

If you want your messages to display correctly everywhere, some care is needed in choosing image formats. If you simply drag and drop an image from another application, it will be sent as a TIFF, and Outlook will not be able to display it (unless you click on Reply; apparently the image viewer in the preview pane is not the same as the one in the Compose window). You should also avoid embedding PDF images.

On the other hand, if you drag or copy/paste a jpeg file in the message, it will be correctly encoded as image/jpeg. Last thing to be aware of: your message should begin and end with text (i.e. you should not embed an image or a file at the beginning or end of file).

If there are problems with the text encoding, the best is to use UTF-8. Here is an interesting post explaining how to do that: in brief, open the Terminal and issue the following:

defaults write com.apple.mail NSPreferredMailCharset "UTF-8"
Warning: The message will be sent in HTML only. This means that it will not be readable by a recipient using a text-only client.

Comments (15)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20070407214643680