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.

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": {
    "type": "email",
    "options": {
      "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 }}
    }
  }
}

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?