Please note that using URI data: will not work for all email clients. Those that use IE as a rendering mechanism do not support it at all if IE8 is not installed, and even then according to Wikipedia , data: URIs are limited to a maximum of 32 KB.
The easiest way to get this to work is to place the image on your own server somewhere and link to it using the full http: // URI. If you cannot do this for any reason (perhaps the image is being created as part of using your application), you can try adding the image as part of the MIME and link to it from HTML.
My email client does not download deleted images automatically, but some spam mails still have images when I open it. Here's how it works:
Attach the image to your mail as suggested by yonel. Somehow you also need to add the Content-ID: header to this part. The contents of this header are then used as the src attribute in your image. The spam message looks like this in HTML:
<img src="cid: image001.jpg@01CACC43.7035CE50 ">
The attachment subcategory looks like this:
Content-Type: image/jpeg; name="image001.jpg" Content-Transfer-Encoding: base64 Content-ID: < image001.jpg@01CACC43.7035CE50 >
Looking at the documentation on addAttachmentData:mimeType:fileName: I assume that you will not be able to get this to work, and you will have to think about sending emails using raw SMTP.
Steve madsen
source share