Sending transactional email using templates

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

It then needs to be sent either via SMTP, or via our API using:

The campaign ID is used in SMTP headers or by the API call to send the triggered campaign as a transactional email.

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's parameters. These take the form of key-value pairs.

📘

Learn more about transactional email

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

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("ThisIsNotUsedInThisTypeOfTransactionalEmailCallItWillbeTakenFromTheCampaign@gmail.com");
  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, from address and content will instead all get taken directly from the created triggered campaign in Dotdigital.