The "email" action supports attaching anything that you can express using JSON. (The rest of this article will assume you're familiar with this action.)

If you happen to have your image data on hand, you could attach it with a line like this:

"attachments": {
  "image.jpg": {{ image_jpg | json }}
}

For Mechanic, it's much more natural for images to be hosted elsewhere, and have those images included in the email body with HTML.

Because the email body supports any CSS and HTML (learn more about this), you might include your image like this:

{% capture email_body %}
  <p>Welcome!</p>
  <p><img src="https://example.com/email_welcome.jpg"></p>
{% endcapture %}
"body": {{ email_body | unindent | json }}

Or, if you absolutely must embed your image file into the email itself, convert your image to an embedded image tag, using these steps:

  1. Open https://ezgif.com/image-to-datauri
  2. Provide the form with your image file, and click the "Upload!" button
  3. On the next page, ensure that the "HTML image src" option is selected, then click the "Convert to data URI!" button
  4. Copy the resulting <img> tag, and add it to your email body
Did this answer your question?