I wish to send an email, with a plain text and html version. The email needs an image to go with it (not one I can host somewhere else), it should be embedded if the client views it in html, and attached for the plain text view.
Is this possible to do that would work in all common clients?
The closest I have come is creating the image as an attachment (rather than a linked resource) then referencing it in the html with cid:filename.jpg. However this doesn’t work in gmail (it doesn’t display the image in the html).
This code snippet works in outlook 2010 and gmail. I test the plain text email by temporarily putting the plain text part last in the email, which makes gmail use that.
It also demonstrates some other cool stuff such as email templates and tag substitution.