inlinemimepostmark

postmark embed image in body


I am using Postmark for sending emails and want to embed image into html_body. I am able to think of two ways to do this.

  1. Get the html body, search for image tags in it. Extract the src of image tags and create an attachement with content id and pass it to postmark.
  2. Create an Multipart MIME message and send it into postmark html_body (but not sure postmark will be able to handle this).

Please suggest me you can think of any other way. And also let me know whether point 2 will work out.


Solution

  • You can use either way to do this.

    If you're using the API, then you can use the first method you suggest, and then simply follow this example (search for Inline image attachments).

    If you are using SMTP, you can include a multipart MIME message with the images as inline/MIME attachments and Postmark will automatically handle that.