Transactional Email via SMTP

Use SMTP to send transaction email using your favourite email tools and or libraries.

SMTP Servers

To send a transactional email using SMTP, you need to connect to the correct server where your account is based:

  • Europe (region 1) - r1-smtp.dotdigital.com
  • North America (region 2) - r2-smtp.dotdigital.com
  • Asia Pacific (region 3) - r3-smtp.dotdigital.com

If you need more guidance on what region you need to use please see this article

Authentication

To be able to send transaction email via SMTP you will need to create a transactional email SMTP user to authenticate with; the full process is explained in our guide here. Use these credentials to authenticate with the SMTP server.

Email content

You can specify the transaction email content directly using the body property in the SMTP send, or using a triggered template.

From address

You should specify the from property to indicate which registered email address against your account the transactional email will be sent from.

🚧

If we cannot recognize the specified from address or non is provided then your accounts default from address will be applied automatically.

Body based

Simply use the body and subject properties in the SMTP send to specify the content of the email.

Template based transactional emails

Users of Dotdigital can create a transactional email template as a triggered campaign in EasyEditor.

Personalisation can also be used in the transactional email template by adding placeholders such as @FIRSTNAME@ in the triggered campaign in Dotdigital.

The personalisation values are then supplied either in the SMTP headers or in the API call parameters. These take the form of key-value pairs.

The numeric triggered campaign id is passed using the X-DM-CampaignID SMTP header and any merge fields in a name value pair array passed in the X-DM-PersonalizationValues SMTP header.

The name value pairs are passed as a JSON array of objects with the following properties:

Property nameValue
NameThe name of the merge field placeholder without the @ symbols. e.g.

If the placeholder is @FIRSTNAME@ in the template then the value would be FIRSTNAME
ValueThe value to be merged into the placeholder in the template

Note: Ensure it is HTTP compatible

🚧

Templates based sends ignore subject and body

Please note as the triggered templates defines what subject and body to use for the transactional email any values passed with the SMTP call will be ignored and the template values used instead.

Limitations

  • You can add a maximum of 100 contacts to the To/Cc/Bcc box for a transactional email, and the send only counts as one send; it doesn’t matter if you have multiple contacts.
  • Sending transactional email using the API doesn't count towards your API limits or usage.
  • You can make up to 25 SMTP connections from a single IP address at any one time.
  • It’s possible to send transactional emails to your unsubscribed or non-mandatorily suppressed contacts. However, you can't send transactional email to an email address that is on the Global Suppression List (GSL).
  • Attachments have a limit of 20MB.
  • Attachments aren't supported, if you're using SMTP to send a transactional email as a triggered campaign.
    50,000 is the default transactional email limit per calendar day. A calendar day is measured using the UTC time zone.

SMTP error codes

You may see the following error codes get returned. If so, we provide some clarification that may help you troubleshoot:

  • 554 Campaign invalid - Can indicate the campaign is not a triggered campaign.
  • 554 Campaign contains unsupported blocks - This indicates that the campaign can't be sent because it contains unsupported EasyEditor building blocks and links (see the list below).
  • 554 Invalid email - Can indicate that the to and from email addresses are invalid.
  • 554 Invalid personalisation values - Can indicate the personalisation values aren't valid JSON strings and aren't escaped properly (especially when an HTML string is provided in the 'Value')

C# code example for SMTP

Whereas the documentation for the relevant API operation/method can be accessed via the links above, we provide an example below of an SMTP call in C#.

string host = "r1-smtp.dotdigital.com";  
string user = "[email protected]";
string password = "somepassw0rd";

using (var client = new System.Net.Mail.SmtpClient(host))
{
  client.Credentials = new System.Net.NetworkCredential(user, password);
  client.Port = 25;
  var message = new System.Net.Mail.MailMessage();
  message.To.Add("[email protected]");
  message.From = new System.Net.Mail.MailAddress("ONE OF YOUR REGISTERED FROM ADDRESSES");
  message.Body = "This is not used in this type of transactional email call. It will be taken from the campaign.";
  message.Subject = "This is not used in this type of transactional email call. It will be taken from the campaign.";
  message.Headers.Add("X-DM-CampaignID", "29898234");
  message.Headers.Add("X-DM-PersonalizationValues", @"[  
                      { Name: ""FIRSTNAME"", Value: ""John""},
                      { Name: ""LASTNAME"", Value: ""Smith""}
                      ]");
                      client.Send(message);

Some fields must be provided according to SMTP protocol but note that they won't be used. The subject line and content will instead all get taken directly from the created triggered campaign in Dotdigital.

📘

Learn more about transactional email

For an overview on transactional email, check out our Help centre article .