Email step

Send an email from a Glue job.

The Email step sends an email from a Glue job. Use it to send customers a message (like a gift card), or to let your team know something needs attention.

Set it up

In the appdata fieldWhat it does
Toto_emailWho gets it. Liquid works, so {{ customer_email }} is fine.
Templateemail_templateCustom (-1) sends the Body below. Or pick one of your email templates.
From namefrom_nameThe name the email shows it's from, like your store name.
Reply-toemail_reply_toWhere replies go, like [email protected].
Subjectemail_subjectLiquid works.
Bodyemail_bodyHTML for the message, used with Custom. Liquid works, including filters like currency.
📘

There's no From address

Email from Glue always comes from [email protected]. Set From name so people know who it's from, and Reply-to so replies reach you.

How it behaves

  • Missing details fail the step. With no To address (for example, a customer with no email), the step fails with missing details from email. Check for an address with an If Condition first.
  • Retries skip it at the top level. A top-level Email that already went out isn't sent again when the job is retried. Inside an If Condition or Loop it is sent again, so put emails at the top level where you can, or late in the branch after the steps that might fail.
  • Tests send for real. Selecting Run in the job editor sends the email. Use your own address while you build.

Example 1: Email a new gift card to the customer

Trigger: System Hook, Create gift card.

  1. Script: Read the gift card

    var card = JSON.parse($.default);
    $.card = card;
    $.customer_email = (card.customer && card.customer.email) || card.customer_email || "";
    $.has_email = $.customer_email !== "";
  2. If Condition: If the customer has an email, Condition $.has_email === true.

  3. Email: Email the gift card, nested under THEN:

    • To: {{ customer_email }}
    • Template: Custom
    • From name: your store name
    • Subject: Your gift card
    • Body: <p>Your gift card {{ card.serial }} is ready, with a balance of {{ card.current_amount | currency: "AUD" }}.</p>

Nest the Email under THEN so it's only sent when there's an address.

Example 2: Tell the floor when a customer has no email

Trigger: Webhook.

  1. Script: Read the payload

    var body = JSON.parse($.default);
    $.reference = body.reference || "";
    $.customer_email = (body.customer && body.customer.email) || "";
  2. If Condition: Check for a customer email, Condition $.customer_email !== "". Put any steps for customers with an email under THEN, or leave it empty.

  3. Email: Email the floor, under ELSE: To [email protected], Subject No email for order {{ reference }}.

Tips

  • Use templates for customer emails. Your email templates keep the look consistent and are easier for the team to change than HTML in a job.
  • Build long bodies in a script. Set $.email_html in a Script step and put {{ email_html }} in Body.

← All Glue step guides


Did this page help you?