E-mail Templates
Last updated
Was this helpful?
Last updated
Was this helpful?
In the Akinon Commerce platform, email templates play a crucial role in maintaining consistent and effective communication with users. These templates are pre-defined email formats used to send automated messages to users based on specific triggers or actions within the platform. This document provides a comprehensive overview of managing email templates, including their loading process, creation, and updating via the Omnitron panel. Additionally, it details the various types of email templates available, their usage, and the context variables associated with each template.
The default email templates are loaded in projects deployed via ACC. This loader checks for the existence of email templates in the following order:
Database:
The loader first checks if the email template exists in the database.
If the template is found in the database, it is used for sending emails.
File System:
If the template is not found in the database, the loader then checks the file system for the template.
The file path for the template is used if it is not present in the database.
Mail templates can be created and managed through the Omnitron panel (Sales Channels > Content Management > Mailing Templates). This interface allows for the management of mail templates used across various sales channels.
Detailed information on creating and updating mail templates via Omnitron can be found in the documentation.
This is a communication email template that allows users to reach out to the brand. Users can select from predefined subjects relevant to their inquiry.
Template Path:
Context Variables:
subject: The subject line of the email, chosen by the user from a list of predefined subjects set by the brand.
full_name: The full name of the user who is sending the email.
email: The email address of the user.
message: The main body of the user's message.
phone: The user's phone number.
file: Any file uploaded by the user. This can include documents, images, or any relevant files that support the user's message.
order: An object representing the user's order details. The details of the order object are provided in the Order table.
operation: The mail group category defined in the module.
site_domain: The domain of the website from which the email is sent.
A password reset email is sent by the commerce platform when a user requests to reset their password. The email facilitates the process by providing a link or instructions for resetting the password.
Template Path:
There is no existing template; it needs to be entered manually into the RESET_EMAIL_HTML_TEMPLATE dynamic setting in Omnitron.
Context Variables:
email: The email address to which the password reset email will be sent. This is the user's registered email address used for receiving the reset instructions.
This email is sent to notify the user about discounts earned after placing an order. The email informs the user about any applicable post-order coupons or discounts.
Template Path:
When creating a campaign in Omnitron with the action type set to "Coupon", a path is generated in the format emails/promotions/{template_prefix}
. This path uses the {template_prefix}
value entered in the "Email Templates" parameter of the coupon information field. Based on the entered {template_prefix}
, a path will be automatically generated.
Example: If you enter summer_sale
as the template prefix, the generated path will be emails/promotions/summer_sale
.
Context Variables:
basket_offer: The BasketOffer
object related to the post-order discount. This object contains details about the discount or promotion applied to the user's order. The details of the basket_offer object are provided below.
basket_offer.label
basket_offer.promotion.name
site_domain: The domain of the website where the order was placed.
user: The User
object representing the user who placed the order. This object contains the user's information necessary for personalization and addressing the email. The details of the user object are provided in the User table.
An email verification message is sent to users to verify their email address during the registration process. However, this behavior can be disabled by configuring the ACCOUNT_EMAIL_VERIFICATION
setting in the Commerce environment of ACC.
Setting ACCOUNT_EMAIL_VERIFICATION = 'none'
disables automatic email verification during registration.
Template Path:
Context Variables:
user: The User
object representing the new user who is registering. This object contains the user's information necessary for personalization and addressing the email. The details of the user object are provided in the User table.
activate_url: The URL provided for email verification. This link redirects the user to a page where they can verify their email address.Example URL: https://akinon.akinon.net/users/registration/account-confirm-email/{confirmation_key}/
current_site: The domain of the verification website.
key: The confirmation key used to authenticate the user's email address. This key is also included within the above activate_url. There is no expiration period for this key.
A notification email sent when loyalty money used in an order is refunded.
Template Path:
Context Variables:
user: The User
object representing the user who is receiving the refund. The details of the user object are provided in the User table.
loyalty_money_amount: The amount of loyalty money that is being refunded.
currency: The currency in which the refunded amount is issued.
order_number: The number associated with the order for which the loyalty money is being refunded.
order_language_code: The language code of the order.
A notification email sent to users when an order is successfully placed. This email is automatically sent during the order creation process.
Template Path:
Context Variables:
order: The Order
object representing the details of the placed order. The details of the order object are provided in the Order table.
site_domain: The domain of the website where the order was placed.
A notification email sent to users when their order has been shipped. This email is triggered when the order status changes to 'shipped = 500'.
Template Path:
Context Variables:
order: The Order
object representing the details of the shipped order. The details of the order object are provided in the Order table.
site_domain: The domain of the website where the order was placed.
A notification email sent when some items in an order are shipped.
Template Path:
Context Variables:
order: The Order
object representing the details of the order. The details of the order object are provided in the Order table.
order_items: The OrderItem
objects that have been shipped. This includes information about the items that are on their way to the customer. The details of the order_items object are provided in the Order_item table.
shipping_company: The name of the shipping company handling the shipment. This helps the customer know which carrier is delivering their items.
tracking_number: The tracking number provided by the shipping company. This allows the customer to track the shipment of the partially shipped items.
site_domain: The domain of the website where the order was placed.
remaining_orderitems: All OrderItem
objects that are still pending shipment. This informs the customer about the items that have not yet been shipped. It includes the same details as the order_items object.
A notification email sent to users when their order is delivered.
Template Path:
Context Variables:
order: The Order
object representing the details of the delivered order. The details of the order object are provided in the Order table.
site_domain: The domain of the website where the order was placed.
return_address: The return address provided in the settings. Enter this into the ORDER_RETURN_ADDRESS
field in the Django settings, with the string type.
A notification email sent when some items in an order are delivered.
Template Path:
Context Variables:
order: The Order
object representing the details of the order. The details of the order object are provided in the Order table.
order_items: The OrderItem
objects that have been delivered. This includes information about the items that have reached the customer. The details of the order_items object are provided in the Order_item table.
shipping_company: he name of the shipping company handling the delivery. This helps the customer know which carrier has delivered their items.
tracking_number: The tracking number provided by the shipping company. This allows the customer to track the delivery of the partially delivered items.
site_domain: The domain of the website where the order was placed.
A notification email sent to users when their order is ready for pickup. This email, triggered when the order arrives at the store, provides information about the pickup process. It simply informs users that their order is ready and provides details on how to collect it.
Template Path:
Context Variables:
order: The Order
object representing the details of the order. The details of the order object are provided in the Order table.
site_domain: The domain of the website where the order was placed.
return_address: The return address provided in the settings.
An email sent to relevant stock locations when a package is prepared or created in the Order Management System (OMS).
Template Paths:
package.created:
For mail body: emails/orders/package-created.html
(This template is used for the body of the email that is sent when a package is created.)
For mail subject: emails/orders/package-created-subject.html
(This template is used for the subject line of the email that is sent when a package is created.)
package.status.preparing:
For mail body: emails/orders/offer-accepted.html
(This template is used for the body of the email that is sent when an offer is accepted.)
For mail subject: emails/orders/offer-accepted-subject.html
(This template is used for the subject line of the email that is sent when an offer is accepted.)
Context Variables:
The payload from the OMS request is directly used as the context. The specific details of the payload are not included due to size, but they typically include information about the package, order details, and relevant stock location data.
Example Payload:
An email sent to users containing the checkout URL. This email provides the user with a direct link to complete their purchase. The user can either scan a QR code in-store or receive the link via SMS, both of which direct them to the checkout page where they can proceed with their payment.
Template Path:
Context Variables:
user: The User
object representing the user who will receive the checkout URL. The details of the user object are provided in the User table.
checkout_url: The URL where the user can complete their purchase.
site_domain: The domain of the website where the order was initiated.
An information email sent to users when they request to cancel or return an order.
Template Paths:
refund: emails/orders/refund-request.html
cancel: emails/orders/cancel-request.html
easy return: emails/orders/easy-refund-request.html
Context Variables:
default:
order: The Order
object representing the order that is being canceled or returned. The details of the order object are provided in the Order table.
site_domain: The domain of the website where the order was placed.
easy return:
return_code: The code assigned to the return request.
order_items: The OrderItem
objects that are being returned via the easy return process.The details of the order_items object are provided in the Order_item table.
A notification email sent to users when a product that was previously out of stock is back in stock. However, it is important to note that no email is triggered for extra stock of the same product once the initial notification has been sent.
Template Path:
Context Variables:
product: The Product
object that is back in stock. The details of the user object are provided in the Product table.
site_domain: The domain of the website where the product is listed.
user: The User
object representing the user who is receiving the notification. The details of the user object are provided in the User table.
A notification email sent to users when the price of a product drops below a certain threshold. This email was not triggered for the extra product stock and extra product price lists.
Template Path:
Context Variables:
product: The Product
object with the price drop. The details of the user object are provided in the Product table.
site_domain: The domain of the website where the product is listed.
user: The User
object representing the user who is receiving the notification. The details of the user object are provided in the User table.
An email sent to the user for activation purposes. After the initial automated activation email is sent (detailed in the 4. Email Verification section), a manual activation email can be resent through Omnitron. This is done by clicking the highlighted button on the User Detail Page in Omnitron.
Template Path:
Context Variables:
verification_code: The code sent to the user for verification. This code is used to verify the user's identity or action and is typically a one-time password (OTP).
A welcome email sent to the user when they register. This email is sent by the allauth package.
Template Path:
Context Variables:
user: The User
object representing the new user who has registered. The details of the user object are provided in the User table.
activate_url: The email verification link that the user must click to verify their email address and activate their account.
current_site: The domain of the verification site.
key: The verification key used to validate the email verification link.
Emails are sent to inform users about specific transitions in the order status. For these emails to be sent, the following conditions must be met. Additionally, if necessary, the corresponding dynamic settings should be configured in Omnitron > Sales Channel Settings > Dynamic Settings page.
Rule:
SEND_SHIPPING_NOTIFICATIONS_PARTIALLY
dynamic setting is set to False
.
The previous status of the order is either OrderStatus.approved
or OrderStatus.preparing
.
The new status of the order is OrderStatus.shipped
.
A tracking number is present on the order.
Email Triggered: When these conditions are met, an email notification is sent to inform the user that their order has been shipped.
Rule:
The previous status of the order is either OrderStatus.shipped
or OrderStatus.shipped_and_informed
.
The new status of the order is OrderStatus.ready_for_pickup
.
Email Triggered: When these conditions are met, an email notification is sent to inform the user that their order is ready for pickup.
Rule:
SEND_SHIPPING_DELIVERED_NOTIFICATIONS_PARTIALLY
dynamic setting is set to False
.
The previous status of the order is either OrderStatus.shipped
, OrderStatus.shipped_and_informed
, or OrderStatus.attempted_delivery
.
The new status of the order is OrderStatus.delivered
.
Email Triggered: When these conditions are met, an email notification is sent to inform the user that their order has been delivered.
Rule:
SEND_SHIPPING_NOTIFICATIONS_PARTIALLY
dynamic setting is set to True
.
is_status_changed
is True
(the order item's status has changed).
The new status of the order item is OrderStatus.shipped
.
A tracking number is present on the order item.
Email Triggered: When these conditions are met, an email notification is sent to inform the user that some items in their order have been shipped.
Rule:
SEND_SHIPPING_DELIVERED_NOTIFICATIONS_PARTIALLY
dynamic setting is set to True
.
is_status_changed
is True
(the order item's status has changed).
The new status of the order item is OrderStatus.delivered
.
Email Triggered: When these conditions are met, an email notification is sent to inform the user that some items in their order have been delivered.
Most emails sent during user membership, order status changes, etc., cannot be disabled. However, the sending of the following email can be stopped by setting the corresponding dynamic setting to False
.
Verification Email
Dynamic Setting: SHOULD_SEND_VERIFICATION_EMAIL
Description: Sent when a user signs up to verify their email address.
To send emails through the application in a local environment, SMTP settings need to be configured. Fill in the following settings with the SMTP server information that will be used for sending emails:
​​If the SMTP server settings are not configured, the content of sent emails will be written to the console. For example, the "Order Received" email sent to the user upon placing an order will be displayed in the console.
Errors in the code blocks responsible for sending emails are usually caught and sent to Sentry. The errors that occur during these send operations can be reviewed in the Sentry logs of the relevant brand. For mail send operations without controlled error handling, the errors can be observed in the application logs.
Most errors during mail sending are related to template rendering. To reproduce and fix these errors, the relevant templates can be rendered locally.
Check Sentry Logs: If your application is integrated with Sentry, check the Sentry dashboard for any errors related to email sending.
Review Application Logs: Look at the console logs for any error messages or stack traces that can provide clues.
Validate Templates: Ensure that all required context variables are being passed to the template and that the template is correctly formatted.
Test Locally: Render the email templates locally with test data to see if any errors occur.
This section provides a detailed overview of various objects and their associated attributes within the system. The objects include Order, Address, Order_item, Product, User, DataSource, and CategoryNode. Each object contains multiple fields that define its properties and relationships with other objects. This structured information is crucial for understanding how these objects interact within the system and for implementing or maintaining related features.
Below is a table outlining the fields and their corresponding objects.
Field Name
Description
order.number
The unique identifier for the order.
order.user → User
The user who placed the order.
order.user_email
The email address of the user who placed the order.
order.bin_number
The BIN (Bank Identification Number) used in the transaction.
order.installment_count
The number of installments for the payment.
order.installment_interest_amount
The interest amount for installment payments.
order.currency
The currency used for the order.
order.status
The current status of the order.
order.amount
The total amount for the order.
order.discount_amount
The total discount applied to the order.
order.shipping_amount
The shipping cost for the order.
order.shipping_tracking_url
The URL for tracking the shipment.
order.shipping_tax_rate
The tax rate applied to the shipping amount.
order.shipping_company
The company responsible for shipping the order.
order.shipping_option.name
The name of the selected shipping option.
order.shipping_option.logo
The logo of the shipping option provider.
order.shipping_address → Address
The shipping address associated with the order.
order.billing_address → Address
The billing address associated with the order.
order.refund_amount
The amount refunded for the order.
order.discount_refund_amount
The amount refunded from the discount.
order.invoice_number
The invoice number associated with the order.
order.invoice_date
The date when the invoice was issued.
order.e_archive_url
The URL to the electronic archive of the invoice.
order.tracking_number
The tracking number for the shipment.
order.gift_box_note
The note included in the gift box.
order.client_type
The type of client.
order.language_code
The language code for the order.
order.notes
Additional notes related to the order.
order.orderitem_set → OrderItem[]
A list of items included in the order.
Field Name
Description
order.orderitem_set[0].product → Product
The product associated with the order item.
order.orderitem_set[0].shipping_tracking_url
The URL for tracking the shipment of the item.
order.orderitem_set[0].datasource → DataSource
The seller for the product.
order.orderitem_set[0].status
The status of the order item.
order.orderitem_set[0].price_currency
The currency used for the item's price.
order.orderitem_set[0].price
The price of the order item.
order.orderitem_set[0].tax_rate
The tax rate applied to the item.
order.orderitem_set[0].invoice_number
The invoice number for the item.
order.orderitem_set[0].invoice_date
The invoice date for the item.
order.orderitem_set[0].e_archive_url
The URL to the electronic archive of the invoice for the item.
order.orderitem_set[0].tracking_number
The tracking number for the item shipment.
order.orderitem_set[0].retail_price
The retail price of the item.
order.orderitem_set[0].image
The image associated with the item.
order.orderitem_set[0].parent → OrderItem
The parent item, if the item is part of a bundle or set.
Field Name
Description
address.user → User
The user associated with the address.
address.title
The title or label for the address.
address.primary (true/false)
Indicates if this is the primary address.
address.email
The email associated with the address.
address.phone_number
The phone number associated with the address.
address.first_name
The first name of the individual.
address.last_name
The last name of the individual.
address.line
The street address or PO box.
address.postcode
The postal code for the address.
address.notes
Additional notes related to the address.
address.company_name
The company name associated with the address.
address.tax_office
The tax office associated with the address.
address.tax_no
The tax number associated with the address.
address.country.name
The country of the address.
address.city.name
The city of the address.
address.township.name
The township or district of the address.
address.retail_store.name
The name of the retail store, if applicable.
address.identity_number
The national identity number.
Field Name
Description
product.data_source → DataSource
The seller for the product.
product.price
The price of the product.
product.retail_price
The retail price of the product.
product.stock
The stock availability of the product.
product.name
The name of the product.
product.base_code
The base code for the product.
product.sku
The stock keeping unit identifier.
product.product_type
The type of product (e.g., simple, bundle).
product.parent → Product
The parent product, if applicable.
product.get_absolute_url()
The URL for the product's page.
product.main_category → CategoryNode
The main category associated with the product.
product.first_category → CategoryNode
The first category associated with the product.
Field Name
Description
user.email_allowed
Indicates if the user allows email communication.
user.sms_allowed
Indicates if the user allows SMS communication.
user.call_allowed
Indicates if the user allows phone calls.
user.phone
The user's phone number.
user.gender
The gender of the user (male, female).
user.date_of_birth
The user's date of birth.
user.user_type
The type of user (registered, guest).
user.first_name
The user's first name.
user.last_name
The user's last name.
user.email
The user's email address.
user.date_joined
The date the user joined the platform.
Field Name
Description
data_source.name
The name of the seller.
data_source.title
The title of the seller.
data_source.supplier_code
The supplier code for the seller.
data_source.address
The address of the seller.
data_source.email
The email associated with the seller.
data_source.phone_number
The phone number associated with the seller.
data_source.fax_number
The fax number for the seller.
data_source.kep_address
The KEP (Registered Electronic Mail) address.
data_source.mersis_number
The MERSIS (Central Registration System) number.
Field Name
Description
category_node.get_absolute_url()
The URL for the category node's page.
category_node.name
The name of the category node.