In my app, I am composing an HMTL email message with the 3.0+ MFMailComposeViewController
.
To do this, I created an HTML file, with some placeholders.
In my cod
Note that using data:
URIs won't work across all mail clients. Those that use IE as a rendering engine don't support it at all unless IE8 is installed, and even then, according to Wikipedia, data:
URIs are limited to 32 KB maximum.
The very simplest way to get this to work is to put the image on your own server somewhere, and reference it using a full http:// URI. If you can't do that for some reason (maybe the image is generated as part of using your app), then you can try attaching the image as a MIME sub-part and referencing it from the HTML.
My mail client doesn't load remote images automatically, but some spam still has images when I open it. This is how it works:
Attach an image to your mail as suggested by yonel. Somehow you need to also add a Content-ID:
header to the sub-part. The contents of this header are then used as the src
attribute on your image. My spam message looks like this in the HTML:
The attachment sub-part looks like:
Content-Type: image/jpeg;
name="image001.jpg"
Content-Transfer-Encoding: base64
Content-ID:
Looking at the documentation for addAttachmentData:mimeType:fileName:
, my guess is that you won't be able to get this to work and will have to consider sending the email using raw SMTP.