You are currently viewing the article on an older Shopware version!

Email templates

General information

In the area Settings > Shop > E-Mail Templates you maintain both the templates for the various mails sent by the shop (e.g. registration information, order confirmation, etc.) and the headers and footers that are integrated into the mails. You can define which mails are sent in which situations in the business events.

As of version 6.4.8.0, the business events are replaced by the flow builder.

For better presentation, the overview is divided into the sections Templates (1) and Header and Footer (2).
You can customize the overview itself by clicking on the symbol in the top right-hand corner of the header line (3).

Here you have the possibility to (de)activate the compact mode (4).
This reduces the line height and therefore more records can be listed before it is necessary to scroll.
You can also show or hide individual columns (5) and determine the order of the columns (6).
Additionally you can define below the list, how many entries should be displayed on one page (7).

To edit an existing record you can open the context menu with the "..." button (8) and select Edit. You can also duplicate or delete a record in the context.

You can open the editor for creating a new data record by clicking on the button Create (9). A sub-menu will appear where you can select whether an e-mail template or header & footer should be created. You will find further information on creating and editing in the sections Email templates and Header & Footer.

Email templates

The e-mail template editor is divided into the sections Information, Options, Attachments and Mail Text.
On the right hand side there is a menu that you can use to send a test e-mail.

Languages(1)
Here you can choose for which language you create/adapt the email template.
Please note that you will only be shown languages that have been created under Settings > Shop > Languages. You can find more information about the languages in the corresponding Wiki article Languages.

Information (2)In the information you first define the basic data of the template.

  • Type: In the type you define for which function this e-mail template is to be used. This could be e.g. customer registration, order confirmation or status change of an order or payment. Predefined types are available for selection in a drop-down menu.

  • Description: Add a description to see at a glance what this template is used for.

Email templates are assigned via the business events. For more information, please refer to the Business Events documentation.

Options (3)
In the options you add the subject and the sender.
Please note that the entry for sender is only the name, which is displayed e.g. within e-mail programs. You can enter the e-mail address that is used for the dispatch under Settings > Shop > Basic information.

Attachments (4)
Here you can add an attachment to your email template by uploading files from your computer, opening media or uploading a file from a URL. If you want to offer the attachment for different languages in your shop, you can add one attachment per language.

Mail text (5)
Here you have the option of storing a template for the mail text. Some mail providers do not allow HTML formated emails, so you should store both HTML and plain text versions of your template.
It is not necessary to enter content that should be inserted at the beginning (e.g. logo) and end (greeting) of each mail here. If these data are identical for each mail template, you can manage them centrally using the headers and footers. You can find more information on this in the section Header & Footer below.

Additional options (6)On the right side you can see a sidebar with tools that help you to create the email templates.

  • Behind the paper airplane symbol you have the possibility to send a test mail to a freely deposited e-mail address.
  • With the </> icon you open a list of all Varieblen that you can use. You can simply copy them out and use them in the e-mail template. 
  • The eye icon offers you a preview of the currently created templates. 
  • Behind the image icon you will find the media in the media management, which you can then drag, for example, into the attachments area. 

To avoid having to maintain the information for headers (e.g. logo) and footers (e.g. greeting formula) in every mail, it is possible to create general headers and footers. You can then assign these to one or more sales channels.
The mask for the creation/editing of headers and footers is structured as following

Language (1)
As with the e-mail templates, you define here for which language headers and footers are to be edited.
Please note that you will only be shown languages that have been created under Settings > Shop > Languages. You can find more information about the languages in the corresponding Wiki article Languages.

Information (2)

  • Name: The name is used in the overview on the start page of the e-mail templates
  • Description: Add a description to show at a glance what this template is to be used for
  • sales channel: Here you define in which sales channels these headers & footers are used

Mail header (3)

Store the e-mail header here in plain text and HTML format. In HTML format it is conceivable to include a logo, among other things.
A logo could, for example, be integrated as follows

 <img src="https://meinshop.de/media/00/a1/2b/12345678/logo.png" alt="Logo" />

Mail footer (4)

Here you can add the email footers in plain text and HTML.

Variables in the mail text

In the mail text you can use variables to access information from the customer or from your store and write them into the email. On the right side you will find a list of all variables via the </> button (1). Below you can display the current email template with the eye symbol (2).

In the mail text you can use variables to access information of the customer or from your shop and write them into the e-mail.
The variables consist of one or more arrays, followed by the actual variable. The variables within two curly brackets are used.
The arrays name the area or sub-area from which a variable is used. The arrays and the variable are separated by a dot.

Example:

{{order.orderCustomer.firstName}}

This example shows the first name of the customer. The variable is called firstName and is located in the array orderCustomer, which is located in the array order.

If you write the two curly brackets in the mail text, you will see the available arrays, which are available in the respective email template. With Enter you can choose the array. In the example of the password recovery email, the array customerRecovery is available.

If you then write a dot after the array, you will see all subarrays and variables available within that array. Now select an array here and write a dot behind it. In this example there are 3 elements which you can select with the arrow keys and confirm with Enter.

If the selected element is the desired variable, you can close it with two closed curly brackets. If it is another array, as in this example with customer, you can look at the elements in this array with a dot. Repeat this until you have found the right variable.

In the following we list the most important variables in the respective arrays:

Customer

Here you can see the most important variables available in the Array Customer.

The array is available in the following mail templates from the standard:

  • Customer group change accepted

  • Customer group change rejected

  • Customer registration

  • Double-Opt-In registration

  • Double-Opt-In-Guest order

  • Customer Group Registration Accepted

  • Customer Group Registration Rejected

  • Password change request

Variable

Sub-elements

Meaning

customerNumber

customer number

firstName

first name

lastName

last name

company

company name

email

email adresse

title

title

firstlogin

first login of the customer

lastlogin

last login of the customer

birthday

birthday of the customer

defaultPaymentMethod

standard payment method

salesChannel

array, which contains further sub-elements. See the table under salesChannel

  • defaultBillingAddress

  • defaultShippingAddress

  • activeBillingAddress

  • activeShippingAddress

  • firstName

  • lastName

  • zipcode

  • city

  • company

  • department

  • title

  • street

  • vatID

  • phoneNumber

  • additionalAddressLine1

  • additionalAddressLine2

  • country

  • countryState

  • salutation

Arrays, which contains further sub-elements with address information. Among others the following information can be found here:

salutation

  • displayName

  • letterName

Salutation or letter salutation e.g. Ms or Dear Ms

customerGroup

Here you can see the most important variables that are available in the array customerGroup.

The array is available in the following mail templates from the standard:

  • Customer Group Registration Accepted

  • Customer Group Registration Rejected

Variable

Sub-elements

Meaning

translated.name

name of the customer group

customerRecovery

Here you can see the most important variables that are available in the array customerRecovery.

The array is available in the following mail templates from the standard:

  • Password change request

Variable

Sub-elements

Meaning

customer

  • firstName

  • lastName

  • email

  • company

  • title

Information about the customer who wants to reset his password.

userRecovery

Here you can see the most important variables available in the array userRecovery.

The array is available in the following mail templates from the standard:

  • user password recovery

Variable

Sub-elements

Meaning

user

  • firstName

  • lastName

  • email

  • username

  • password

  • aclRoles

Information about the customer who wants to reset his password.

newsletterRecipient

Here you can see the most important variables available in the array newsletterRecipient.

The array is available in the following mail templates from the standard:

  • newsletter registration

  • Newsletter Double-Opt-In

Variable

Sub-elements

Meaning

firstName

first name

lastName

last name 

zipCode

postcode

city

city

street

street

email

email adresse

contactFormData

Here you can see the most important variables available in the array contactFormData.

The array is available in the following mail templates from the standard:

  • contact form

Variable

Sub-element

Meaning

firstName

first name

lastName

last name

phone

telephone number

subject

subject

comment

comment

email

email adresse

order

Here you can see the most important variables available in the Array order.
The array is available in the following mail templates from the standard:

  • Order confirmation

  • Entry delivery status: Open

  • Entry Delivery status: Sent

  • Entry Delivery status: Partially shipped

  • Entry delivery status: Cancelled

  • Admission Delivery status: Retour

  • Admission Payment status: Refunded

  • Admission Payment status: Paid

  • Entry Payment status: Open

  • Admission Payment status: Partially refunded

  • Entry Payment status: Remembered

  • Admission Payment status: Partially paid

  • Entry Payment status: Canceled

  • Admission Order status: Open

  • Entry Order status: In process

  • Entry Order status: Cancelled

  • Admission Order status: Completed

Variable

Sub-elements

Meaning

orderNumber

order number

orderDateTime

date and time of order

price

  • netPrice

  • totalPrice

  • positionPrice

  • taxStatus

Array, which contains further sub-elements of the price like netPrice for the net price of the shopping cart or totalPrice for the gross price of the shopping cart.

shippingTotal

shipping costs

orderCustomer

siehe Tabelle Customer

data of the customer who placed the order.

currency

  • isoCode

  • factor

  • symbol

  • shortName

Array, which contains further sub-elements of the currency like isoCode or symbol.

adresses[0]

  • firstName

  • lastName

  • zipcode

  • city

  • company

  • department

  • title

  • street

  • vatID

  • phoneNumber

  • additionalAddressLine1

  • additionalAddressLine2

  • country

  • countryState

  • salutation

Array, which contains further sub-elements with address information.

deliveries[0]

  • shippingOrderAddress

  • shippingMethod

  • trackingCodes[0]

array, which contains further sub-elements with information about the dispatch. For example, the arrays shipping OrderAddress ,shippingMethod or trackingcodes are subordinated, which contain information about the shipping address ,shipping method or tracking codes.

transactions.first

  • paymentMethod

  • stateMachineState

array, which contains further sub-elements with information about the payment. For example, the paymentMethod or stateMachineState arrays are subordinate, which contain information on the payment method and payment status.

lineItems[0]

  • quantity

  • unitPrice

  • totalPrice

  • label

  • description

  • price

  • payload.productNumber

below the lineItems Array there is information about each item of the order. The number in the square brackets indicates the respective position, starting with 0.

stateMachineState

name

order status

Example: Individual email template depending on the payment method
It often happens that an individual email template is required for each payment type. For example, for an order confirmation. In the case of payment paid in advance, it is best to automatically store the appropriate account details in the email. For this purpose, it is necessary to find out the ID of the payment type and to include it in the email template using a variable.

You can obtain the ID of a payment method by going to Settings > Payment methods in your administration and selecting, for example, "Prepayment". The ID is now in the URL.

You can now insert the ID into the email template. This can look as follows for prepayment:

{% for transactions in order.transactions %}
{% if transactions.paymentMethodId == "ID-from-the-URL" %}

Please transfer the amount of XX EUR within 3 days to the bank account below so that we can send your package as soon as possible.

Our bank account details:
IBAN: DEXX XX
BIC: XXXX
Purpose: {{ order.orderNumber }}
Total amount to be transferred: XXX €
{% endif %}
{% endfor %}

salesChannel

Here you can see the most important variables that are available in the array salesChannel.
The array salesChannel is available in all mail templates from the standard.

Variable

Sub-elements

Meaning

name

name of the sales channel

domains[0]

url

information of the individual sales channel domains. The number in the square brackets indicates the beginning of the respective domain

Custom fields

In the Settings > System > Custom fields section, you can create an custom field and use it in the email template.
How to create custom fields and configure them can be found here.
After you have created an custom field and specified the area where it should be used, you can now use it in the email template.
If you have selected the custom field for the customer area, the variable looks like this:

{{customer.customFields.additional_info}}

"additional:info" is used here as an example for the technical name of the custom field.

 

It is advisable to map the whole thing with the Flow Builder.

First of all, you have to define a rule for this in the Rule Builder.



The corresponding flow must then be set up.

 

Was this article helpful?