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 app | data field | What it does |
|---|---|---|
| To | to_email | Who gets it. Liquid works, so {{ customer_email }} is fine. |
| Template | email_template | Custom (-1) sends the Body below. Or pick one of your email templates. |
| From name | from_name | The name the email shows it's from, like your store name. |
| Reply-to | email_reply_to | Where replies go, like [email protected]. |
| Subject | email_subject | Liquid works. |
| Body | email_body | HTML for the message, used with Custom. Liquid works, including filters like currency. |
There's no From addressEmail 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.
-
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 !== ""; -
If Condition: If the customer has an email, Condition
$.has_email === true. -
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>
- To:
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.
-
Script: Read the payload
var body = JSON.parse($.default); $.reference = body.reference || ""; $.customer_email = (body.customer && body.customer.email) || ""; -
If Condition: Check for a customer email, Condition
$.customer_email !== "". Put any steps for customers with an email under THEN, or leave it empty. -
Email: Email the floor, under ELSE: To
[email protected], SubjectNo 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_htmlin a Script step and put{{ email_html }}in Body.
Updated about 23 hours ago
