dmurvihill/courier

[Help] How to embed images within the body of email ?

Closed this issue · 3 comments

Hi @softprops ,

I have been using this library quite successfully for some time now and I was wondering if it's possible to embed image within the body itself rather than as an attachment?

Please help me out a bit here :)

Embedding an image means sending an HTML mail using img-tags. You either have to specify the image url or embedd the image using base64 encoding.
https://sendgrid.com/blog/embedding-images-emails-facts/ should help

r57 commented

Third option should be: add image as MimeBodyPart to Multipart content, set proper content id and set img tag src attr as cid:your_content_id.

@r57 Hmm, I see.

This one helped me get it down in an easier way 👍