Email - aareano/ifshop-wiki GitHub Wiki
The email action is available for all events.
Fields
Emails have 6 text fields:
- From
- This field is not editable - emails will always be sent from an ifshop address.
- To
- Cc
- Bcc
- Subject
- Body
Hint: All address fields support multiple (comma-separated) addresses.
Warning: Invalid addresses will be removed upon sending or preview.
Warning: The email will never be sent unless both Reply To and To have at least one valid address each. An entry may still appear in your activity log if this happens, but don't be fooled!
Test Emails
You can use the Send test email button and popover to send yourself or someone else a test email to see what your email would like in an email client. The test email is only sent to the email address you specify in the popover - it is not sent to any of the email addresses listed in any of the other address fields.
Helpful Hints
Since ifshop is not hosted by shopify itself, URLs need to be absolute instead of relative. For example to include a stylesheet in your email:
- In emails sent by Shopify, you would write:
<link rel="stylesheet" type="text/css" href="/assets/notifications/styles.css">
- In email sent by ifshop, you need an absolute URL:
<link rel="stylesheet" type="text/css" href="https://myshop.myshopify.com/assets/notifications/styles.css">
Liquid
All fields have pretty close to full support for liquid templating (docs). For exact details on what's support and what isn't, here's the spec.
Hint: Shopify put together a tutorial on building email templates.
Hint: For examples on email templates, check out your shop's notification settings page in your shop's admin at Settings > Notifications.
Global Shop Liquid Variables
There are a few pieces of Shopify's email liquid templating set-up that are not accessible from Shopify's API, including the three global shop liquid variables that are available in all of Shopify's email template:
{{ shop.email_logo_url }}
{{ shop.email_logo_width }}
{{ shop.email_accent_color }}
Much as I would like to streamline the processes for you, I cannot. It is up to you to port these values over to ifshop. Here's how:
- Navigate to your email template settings page (Settings > Notifications)
- Click the "Customize" button on the top-left
{{ shop.email_logo_url }}
- Right click on the image of your logo (add a logo if you haven't yet) and select "Copy image address"{{ shop.email_logo_width }}
- Copy the "Logo width (pixels)" value{{ shop.email_accent_color }}
- Copy the "Accent color" value (including the "#" sign)- Go to ifshop and open the edit page of any rule with "send an email" as the action
- In the rule's edit page, click "EDIT SHOP LIQUID VARIABLES"
- Paste the value you copied into the correct text field to the right of the equal sign
Roadmap: Eventually, you'll be able to add, remove and edit entries for your shop's global liquid variables.
Liquid variables by event class
Depending on the event class, different liquid drops are exposed for use in the email template. To see which liquid drops are defined for which event, check out the Event Classes section on the right.
If the event class is Customers, here's an example snippet you could use.
Input
<p>
Welcome, {{ customer.name }}, to {{ shop.name }}!
</p>
<p>
<a href="{{ shop.url }} style="color: {{ shop.email_accent_color }}">Come visit!</a>
</p>
Output
<p>
Welcome, Sam Adams, to My Shop!
</p>
<p>
<a href="http://myshop.myshopify.com/" style="color: #90C3D4">Come visit!</a>
</p>
Note: the shop
drop is available for all events via shop.property_name_here
.