Email runs everything. Mechanic sends email. You're covered. 👌

The email action type accepts these options:

  • The recipient (including CC and BCC)
  • The subject
  • The body
  • Reply to
  • The sender display name
  • The name of an email template to use (see our tutorial: Add an email template)
  • A set of attachments

By default, the sender email address will look like this (assuming a Shopify account domain at my-fantastic-shop.myshopify.com):

my-fantastic-shop@mail.usemechanic.com 

To change this to an email address of your own, there are a couple quick steps to take. Learn more here.

For developers

Options

  • "to" – required
  • "cc" – optional
  • "bcc" – optional
  • "subject" – required
  • "body" – required; allows HTML and CSS
  • "reply_to" – optional
  • "from_display_name"  – optional; will be combined with the shop's assigned sender address
  • "template" – defaults to "default"; used to specify an email template from the store's Mechanic settings
  • "attachments" – can be set to a JSON object of file names (strings), mapped to file contents (strings)

A quick note about attachments

Mechanic will auto-detect file types based on file names, and attach them appropriately. For example, to attach a simple CSV, use this:

"attachments": {
  "simple.csv": "Question,Answer\nIs it simple?,Yes"
}

There is one notable special case: this action supports converting HTML to PDF, so as to attach custom-generated PDF files. To take advantage of this, set the attachment content to an object, containing an "html" key. Here's how this might look:

{% capture pdf_html %}
<html>
  <body>
    <h1>Certificate for {{ customer.email }}</h1>
    <p>This hereby certifies that you are a customer.</p>
  </body>
</html>
{% endcapture %}

{
  "action": {
    "type": "email",
    "options": {
      "to": {{ customer.email | json }},
      "subject": "Your certification",
      "body": "Please see attached.",
      "reply_to": {{ shop.customer_email | json }},
      "from_display_name": {{ shop.name | json }},
      "attachments": {
        "certification.pdf": {
          "html": {{ pdf_html | json }}
        }
      }
    }
  }
}

Other examples

{
  "action": {
    "type": "email",
    "options": {
      "to": "hello@example.com",
      "subject": "Hello world",
      "body": "It's a mighty fine day!",
      "reply_to": {{ shop.customer_email | json }},
      "from_display_name": {{ shop.name | json }}
    }
  }
}

This example hard-codes the recipient, the subject, and the body. It then uses your shop's customer service email as the "reply-to" header, and uses the shop's own name as the display name for the "from" header.

Try using Liquid filters to make using captured values easy:

{% capture email_body %}
  <b>Hello!</b>

  It's fantastic to see you!
{% endcapture %}

{
  "action": {
    "type": "email",
    "options": {
      "to": "hello@example.com",
      "subject": "Hello world",
      "body": {{ email_body | unindent | strip | newline_to_br | json }}
    }
  }
}

Did this answer your question?