Email customers when tagged with Mechanic.

Mechanic is the one-tool-does-it-all automation app for Shopify. :)

Email customers when tagged

by Isaac Bowen (

Automatically send out an email to your customers when a tag is added to their account. Useful for sending approval emails, welcome emails if the customer was created with a certain tag, or any other emails related to an update to the customer's status. The most common use of this task is to send out emails to customers when their accounts are approved, but you can use this task to email customers any kind of alert you like, triggered by a simple tag. For example, some themes include an email subscription form that creates a customer record, pre-tagged with "email subscribe", or something to that effect.

Runs when a customer is created and when a customer is updated. Configuration includes tag to watch for, email subject, email body, and email template html.

15-day free trial – unlimited tasks


This task monitors customer updates and new customer registrations, looking for the tag of your choice. When a customer record is created with that tag, or has that tag added to it, this task will send the customer an email.

To use a rich email template, with HTML and CSS, set up your template with the text EMAIL_BODY where you'd like Mechanic to fill in the text of your email message. Then, paste all the code for your template into the "Email template HTML" task option.

Important notes

  • This task also adds a second tag when the email is sent, as a flag to mark the customer as having received that email. This helps Mechanic remember who not to send an email to.
  • To help out merchants who have lots of existing customers, this task doesn't watch customers whose records were created before you add this task to your Mechanic account.

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

when a customer is created (shopify/customers/create)
when a customer is updated (shopify/customers/update)
tag to watch for (required), email subject (required), email body (required, multiline), email template html (code, multiline)
{% assign approval_tag = options.tag_to_watch_for__required %}
{% capture email_sent_tag %}{{ approval_tag }}-email-sent{% endcapture %}
{% assign customer_tags = customer.tags | split: ", " %}

{% assign customer_qualifies = false %}
{% assign customer_created_at = customer.created_at | date: "%s" %}
{% assign task_created_at = task.created_at | date: "%s" %}
{% if customer_tags contains approval_tag and customer_created_at >= task_created_at %}
  {% unless customer_tags contains email_sent_tag %}
    {% assign customer_qualifies = true %}
  {% endunless %}
{% endif %}

{% assign email_subject = options.email_subject__required %}
{% assign email_body = options.email_body__required_multiline | strip | newline_to_br %}

{% assign email_template = options.email_template_html__code_multiline %}
{% if email_template == blank %}
  {% assign email_template = "EMAIL_BODY" %}
{% endif %}

{% assign email_html = email_template | replace: "EMAIL_BODY", email_body %}

{% if event.preview or customer_qualifies %}
    "action": {
      "type": "email",
      "options": {
        "to": {{ | json }},
        "subject": {{ email_subject | json }},
        "body": {{ email_html | json }},
        "reply_to": {{ shop.customer_email | json }},
        "from_display_name": {{ | json }}

    "action": {
      "type": "shopify",
      "options": [
          {{ | json }}
          "tags": {{ customer.tags | add_tag: email_sent_tag | json }}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Tag to watch for
Email subject
Your account has been approved!
Email body
Hi {{ customer.first_name | default: "there" }},

Your account for {{ }} has been approved! Thanks for registering, and we'll see you soon.

The team at {{ }}