Does Mechanic support rich email?

Yes, Mechanic's email action supports HTML and CSS in the email body. We process CSS for you, so you're free to use <style> tags without worrying about email client compatibility.

Learn about embedding images in your emails. You can also use email templates for a standard look, shared across tasks.

If you're simply trying to add formatted text and aren't ready to dig into the code yourself, try using a tool like wordtohtml.net to quickly generate usable HTML.

To illustrate this, here's an example task script:

{% capture email_body %}
<p>Hello,</p>

<p>Thanks for your interest! <a href="https://example.com/">Would you like to learn more?</a>

<p>Cheers,</p>

<p>&ndash; The team at <a href="https://{{ shop.domain }}/">{{ shop.name }}</a></p>

<hr>

<p style="color: #888">This email brought to you by Mechanic</p>
{% endcapture %}

{% action "email" %}
  {
    "to": "test@example.com",
    "subject": "This is an HTML message!",
    "body": {{ email_body | json }},
    "reply_to": {{ shop.customer_email | json }},
    "from_display_name": {{ shop.name | json }}
  }
{% endaction %}

If you're seeing extra blank lines in your emails that you weren't expecting, check to see if your script is automatically generating linebreaks, like so:

"body": {{ email_body | newline_to_br | json }},

Most predefined tasks in Mechanic's library include this as a feature, converting blank lines to linebreak tags so that you can write emails without having to worry about HTML.

To disable that functionality, just remove the newline_to_br filter, resulting in something like this:

"body": {{ email_body | json }},
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.