Understanding Message Templates In nopCommerce

In nopCommerce, message templates are pre-defined email templates (with content) that are being sent from the website automatically based on various actions such as: customer receives the order details in email right after placing an order on the store site, a new customer receives a welcome email right after registration, a customer receives a newsletter subscription activation message in email and much more.

How message templates work in nopCommerce



Prerequisite(s)

In order for message templates to work properly in nopCommerce, a store owner (or admin) needs to configure the email account(s) in the administration section. Without any saved mailbox, an email cannot be sent from store site and the message will always be stuck in the queue. To configure an email account, please go to:

Administration > Configuration > Email Accounts



How message template looks like in customer's inbox

For instance, let’s take an example of a situation in which a customer has placed an order on the nopCommerce store site. In this case, the order is considered as an action on the site and this action will trigger the order related message template(s).

  • Customer will receive an email with the order details
  • Store admin will receive an email with a notification that somebody placed an order on the site

In both cases, the order content will be generated dynamically from order message template(s) saved in the database.

Here is a screenshot of customer’s email



Here is a screenshot of store owner’s email,



Location of message templates in nopCommerce

nopCommerce offers (out of the box) a list of all the necessary message templates that a store owner would need to run an online business. A store owner can access these message templates in the administration section by going to the following location.

Administration > Content Management > Message Templates



Here, you should be able to see list of all the message templates that come with nopCommerce out of the box:



If you open any message template from the list, you will see the structure (body) of the message like this:



What are message tokens and how can tokens be used in message templates in nopCommerce?

Message tokens are simple variables saved in the nopCommerce site that can be used in message templates and these variables are replaced dynamically right before an email is sent out. There is one important point there that store owner should keep in mind, which is that not all variables (tokens) are always replaced.

All the emails that are being sent by nopCommerce store site are first stored in the queue where the conversation takes place (all the variables / tokens are converted into respective values based on the customer’s account). Within the system, there is a scheduled task that executes the queue and sends out the email to the customer (or store owner).

Examples of message tokens:

  • Your online store name: %Store.Name%
  • Order number: %Order.OrderNumber%
  • Customer’s full name in the order: %Order.CustomerFullName%
  • Shipment tracking number: %Shipment.TrackingNumberURL%

You can find all the message tokens right above your message template like this:



Message templates in multi-store

If you are using the multi-store feature in nopCommerce and running a number of online stores, you can limit any message template to a particular store online like this,

  • Select any message template
  • Click “Edit”
  • Click on the 2nd tab “Stores” on Edit message template details page
  • Enable “Limited to stores” checkbox
  • Select the store for which you would like to limit the message template



Using different email account for different message templates

In many situations, store owner may want customers to receive emails generating from the store site go from different email address. This can be helpful in managing different kinds of emails in different mailboxes for example:

  • Order related email should go from orders@yourstore.com
  • Welcome email should go from donotreply@yourstore.com
  • Return email should go from returns@yourstore.com
  • Shipment email should go from ship@yourstore.com

You can select any configured email account for a specific message template on the “Edit message template details page” like this:



Message templates with attachment

In many types of businesses, any online store may have a requirement to email attachment(s) to the customers. nopCommerce offers the feature of attachment to message templates out of the box. The feature is very user-friendly and a store owner can easily configure the option by going to the message template “edit details” page and enable the “attachment” checkbox like this:

  • nopCommerce can be download here:
  • nopCommerce Version (used in this article): Version 3.70
  • nopCommerce Support