Sending transactional mails
This topic is for administrators and developers with administration access rights in Spryker.
This topic describes how to configure sending of transactional mails An email triggered by a recipient action (such as an order or purchase) or event (such as an anniversary). It is sent out subsequent to the event. when using Spryker as e-commerce platform with Optimizely Campaign. The sending is done via HTTP-API directly from Spryker.
You can use transactional mails to respond to customers' actions in your shop, such as order confirmations, or to send system emails, which include:
- Login confirmation
- Password changes and confirmation
- Order confirmations
Configuring transactional mails in Optimizely Campaign
Sending of transactional mails requires a template in Optimizely Campaign, which uses field functions to insert sent variables into relevant locations. This creates the finished transactional mail with layout, and sends it to the recipient. The sending and receiving of the content of the variables takes place using the transaction recipient list as a buffer.
- The Spryker integration sends the variables.
- The variables are written into the transaction recipient list: each variable into the relevant recipient list field.
- Using field functions, Optimizely Campaign copies the template with the individual variables from the transaction recipient list and places it into the desired location in the transactional mail.
Recipient list fields in Optimizely Campaign's transaction recipient list
By default, the transaction recipient list contains the following fields.
Field name | Data type | Description |
---|---|---|
String | Email (required) | |
salutation | String | Title |
firstname | String | First name |
lastname | String | Last name |
spryker_id | String | Spryker ID |
customer_shop_locale | String | Language setting in customer shop |
customer_shop_url | String | Customer shop url |
customer_login_url | String | Customer login url |
customer_reset_link | String | Customer reset link |
language | String | Language |
order_number | String | Order number |
order_comment | String | Order comment |
order_orderdate | String | Order date |
order_subtotal | String | Order Subtotal |
order_discount | String | Discount on order |
order_tax | String | Tax on order |
order_grand_total | String | Total sum of order |
order_total_delivery_costs | String | Delivery costs |
order_total_payment_costs | String | Payment costs |
subscriber_key | String | Individual key of user in Spryker Commerce |
Creating a template in Optimizely Campaign
Create a template and add the desired transactional mail texts (the unchangeable, static texts that are to be sent to recipients). Insert field functions in places where you want to show content of the Spryker variables.
About field functions
Field functions are placeholders that refer to a specific recipient list field in your transaction recipient list. The variables and content of the variables sent from Spryker are written into the relevant recipient list fields in your transaction recipient list. Your field functions load relevant content from the referenced recipient list field in the next step.
Example
Set up a transactional mail text that welcomes each customer using the last name and the order date. For this you would need the variables salutation, lastname and order_orderdate.
The content of the variables is first written to a relevant recipient list field of the transaction recipient list (from Spryker via the HTTP API). To access these recipient list fields, insert the individual field functions into the Optimizely Campaign template and place the name of the recipient list field in curly brackets. To import the variable contents, the static text and field functions in the Optimizely Campaign template could look like this:
Hello, {salutation} {lastname}!
Thank you for your online order from {oder_orderdate}.
The example will appear in the sent transactional mail as follows:
Hello, Mr. Miller! Thank you for your online order from August 3.
To create the template, do the following:
- Open the Optimizely Campaign menu and select Campaigns > Transactional Mails.
- Click Create….
- Drag the Recipients node from the left action area to the workspace area on the right.
- In the Recipient lists drop-down list, select your transaction recipient list.
Customer support sets up a separate transaction recipient list. Be sure you use this transaction recipient list, instead of a regular recipient list. To see if a recipient list is a transactional recipient list, check the column Transaction API.
- From the left action pane, drag an Emailmessage node into the workspace.
- In the Name box, assign a concise name to your transactional mail (for example, Order confirmation).
- In the context menu for the message node, click Edit Content….
- In the Template drop-down list, select the desired template and confirm your selection by clicking Next.
- Configure the template for the transactional mail according to your requirements. Enter a subject and insert the static texts that you want recipients to receive, into the content paragraphs. Insert the relevant field function for the recipient list field of the transaction recipient list into places where variables from Spryker should appear (see the previous example in this topic).
- Click Close.
- Connect the Recipient node with the message node.
- Click Save and Close.
- To activate your transactional mail and start the sending process, select the mailing in the Transactional mails overview and click Start.
Configuring transactional mails in Spryker
To set up transactional mails in Spryker, follow the steps on the Spryker documentation website.