Create an email template
This topic describes how to create, edit, and submit an email template for review.
Template list
The template management page in the DirectMail console displays the name, status, creation time, and available actions for each template.
An email template can have one of three statuses: Draft, Approved, or Rejected. For a template in the Draft status, you must click Submit for Approval. You can use the template to send emails only after the DirectMail operations team reviews and approves it.

Create a template
1. Log on to the DirectMail console.
2. In the left-side navigation pane, click Templates.
3. In the upper-right corner of the Templates page, click Create Template to open the template creation page.
4. On the template creation page, enter the required parameters, and then click Save in the lower-right corner. The saved template is in the Draft status. You can edit, submit it for review, or delete it.

Variables
In an email template, a variable represents dynamic, personalized information from a recipient list. You can embed a variable as a placeholder in the email body by using the format {VariableName}. The system automatically replaces the placeholder with the corresponding data for each recipient when the email is sent.
Rules and examples:
Format: A variable name must be enclosed in curly braces, for example,
{UserName}or{Birthday}.Data source:
On the Send Test Email page, you can enter test values for variables (see below), such as John.
For production use, you must upload corresponding column values when you create a recipient list. Otherwise, the system cannot replace the variables correctly. You can upload an attachment or provide a single entry in JSON format, for example,
{"UserName":"John Doe","Birthday":"1990/01/01","Gender":"Ms."}.
Naming conventions: Variable names can contain only uppercase and lowercase English letters, such as
UserNameandBirthday.Limit: A single email template can contain up to 50 variables.
Example email body:
Hello, {UserName}{Gender}, your email address is {EmailAddr}, and your birthday is {Birthday}. Welcome to DirectMail.
Images
Email templates do not currently support inserting local images. You can only insert image URLs that start with HTTPS and allow hotlinking. You can host images on a service, such as an online photo album, to generate a URL, and then add the URL to your email template.


Unsubscribe link
Click the Hyperlink button and select Unsubscribe link. Recipients can use this link to unsubscribe from your emails.

When you send emails from the console or by using an API, the system automatically replaces the variable ${DM:UNSUBSCRIBE_LINK} with an unsubscribe link.
When you send emails via SMTP, you must first enable data tracking for the variable to be replaced correctly. How to enable the data tracking feature?
HTML sample code (for API and SMTP reference only): <a href="${DM:UNSUBSCRIBE_LINK}" title="test" data-link-type="unsubscribe" target="_blank">test</a>
Unsubscription management
You can manage unsubscription records in the DirectMail console. Go to Data Analytics > Unsubscribed.
5. After you create an email template, you must submit it for review. The review process typically takes 1 to 3 business days. If a template is rejected, you can edit it and submit it for review again.
Each account can save up to 100 email templates. You can edit these templates multiple times or delete them.
The body of an email template is limited to 1 MB.
The email subject is limited to 100 characters.
If you edit an approved template or one that has been used to send emails, its status changes to Draft. You must submit it for review again.
Send a test email
Enter and save your email content.

Click the Send Test Email tab, select a sender address, enter variable values and a recipient address, and then click Send.

The recipient will see that the variables in the email have been replaced with the corresponding values.

The system sends test emails from a random address. When sending production emails, you can choose whether to use a random address.