{"_id":"59396d9e0073e80027c8b781","project":"55dd9f2e0efd5821000d54d9","version":{"_id":"55dd9f4dab0e4d210045aae9","__v":39,"project":"55dd9f2e0efd5821000d54d9","createdAt":"2015-08-26T11:13:17.024Z","releaseDate":"2015-08-26T11:13:17.024Z","categories":["55dd9f4dab0e4d210045aaea","55ddb5fa9067202b00ddff6f","55e0472c6bad670d0081f213","55e04764a44fae0d00214671","55e047a9a44fae0d00214672","55e047b258c5460d0076a9a7","55e95e337fc27b2d00d32cf2","55e979bda7ca823900ad549a","55edb8c18dcb210d0056900b","55f0365c8563861700a33765","55f03677d58f9b1900acf996","55f036938eeefc23001ea5de","55f036a38563861700a33767","55f036c08563861700a33769","55f036d02911b72100482cd7","55f036e92911b72100482cd9","55f036fa8563861700a3376b","55f0370ee507711900e58c69","55f0371df6101b1900c70700","55f0374f2911b72100482cdb","55f0375e2911b72100482cdc","560eb0f659cb8d0d0015cd52","560eb25239fad419002ae1e0","561fb64d4d67490d00804b2a","562b9f775a39cd0d009aff22","562ba0505a39cd0d009aff23","562ba149d56bc30d00f0cb18","562ba595f68a5f0d007b1f3b","562ba78fd56bc30d00f0cb1b","562ba8b95a39cd0d009aff27","562baadf6562140d001501d2","562bab37f68a5f0d007b1f3d","562bc1bf9ebc950d000f7523","562bc99ced4bea0d00c11dfa","562bd29c1b98640d00714520","562bd5875a39cd0d009aff60","562bdfabff2da50d002c0aaf","562be0bd5a39cd0d009aff75","57a0b476d8313e1900454439"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"category":{"_id":"55dd9f4dab0e4d210045aaea","pages":["55dd9f4dab0e4d210045aaeb","55e96008ffba3323004216ea","55e96030e5d0c623003ed885","55e97a097f564237001d5b80","56795de3ade8221700923d2c","56797b1584397c0d00fe13ea"],"version":"55dd9f4dab0e4d210045aae9","__v":6,"project":"55dd9f2e0efd5821000d54d9","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-26T11:12:47.544Z","from_sync":false,"order":0,"slug":"overview","title":"Overview"},"user":"55dd9841cafe7221002a4c62","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-08T15:30:38.687Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"Users of dotmailer can create a transactional email template as a triggered campaign in EasyEditor.\n\nIt then needs to be sent either via SMTP, or via our API using:\n\n  * [Send transactional email using a triggered campaign](https://developer.dotmailer.com/docs/send-transactional-email-using-a-triggered-campaign) (REST)\n  * [SendTransactionalEmailTriggeredCampaign](https://developer.dotmailer.com/docs/sendtransactionalemailtriggeredcampaign) (SOAP)\n\nThe campaign ID is used in SMTP headers or by the API call to send the triggered campaign as a transactional email.\n\nPersonalisation can also be used in the transactional email template by adding placeholders such as :::at:::FIRSTNAME@ in the triggered campaign in dotmailer.\n\nThe 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.\n\n## C# code example for SMTP \n\nWhereas 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#.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"string host = \\\"r1-smtp.dotmailer.com\\\";  \\n            string user = \\\"transactionalemail-ddfe1abd8@apiconnector.com\\\";\\n            string password = \\\"somepassw0rd\\\";\\n\\n            using (var client = new System.Net.Mail.SmtpClient(host))\\n            {\\n                client.Credentials = new System.Net.NetworkCredential(user, password);\\n                client.Port = 25;\\n                var message = new System.Net.Mail.MailMessage();\\n                message.To.Add(\\\"customer@somedomain.com\\\");\\n                message.From = new System.Net.Mail.MailAddress(\\\"ThisIsNotUsedInThisTypeOfTransactionalEmailCallItWillbeTakenFromTheCampaign@gmail.com\\\");\\n                message.Body = \\\"This is not used in this type of transactional email call. It will be taken from the campaign.\\\";\\n                message.Subject = \\\"This is not used in this type of transactional email call. It will be taken from the campaign.\\\";\\n                message.Headers.Add(\\\"X-DM-CampaignID\\\", \\\"29898234\\\");\\n                message.Headers.Add(\\\"X-DM-PersonalizationValues\\\", @\\\"[  \\n                    { Name: \\\"\\\"FIRSTNAME\\\"\\\", Value: \\\"\\\"John\\\"\\\"}\\n                    { Name: \\\"\\\"LASTNAME\\\"\\\", Value: \\\"\\\"Smith\\\"\\\"}\\n                ]\\\");\\n                client.Send(message);\\n\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nSome fields must be provided according to SMPT 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 dotmailer.\n\n## SMTP error codes \n\nYou may see the following error codes get returned. If so, we provide some clarification that may help you troubleshoot:\n\n  * **554 Campaign invalid** - Can indicate the campaign is not a triggered campaign.                               \n  * **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).\n  * **554 Invalid email** - Can indicate that the to and from email addresses are invalid.\n  * **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')\n\n## Unsupported EasyEditor building blocks \n\nTransactional email templates don't support the following EasyEditor building blocks and link types:\n\n  * 'RSS feed'\n  * 'Sharing'\n  * 'Social links'\n  * 'Dynamic content' (this also includes classic dynamic content)\n  * 'External dynamic content'\n  * 'Advanced personalisation' blocks\n  * 'Forward to a friend' link\n  * 'Unsubscribe' link (but you will need to include one in order to save your template in EasyEditor; see 'About unsubscribe links' below)\n  * 'View in browser' link\n  * 'Double opt-in' link \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"When making use of transactional email personalisation, the type of personalised content needs to be compatible with the HTML element it's being put into in EasyEditor. For example, if your code contains a personalised table, it will need to go into a table element in the template, not a paragraph. \\n\\nCheck with your campaign designers to ensure that their campaign's elements are suitable for the personalisation content being used.\",\n  \"title\": \"A note on HTML compatibility for personalisation content\"\n}\n[/block]","excerpt":"","slug":"sending-a-transactional-email-as-a-triggered-campaign","type":"basic","title":"Sending a transactional email as a triggered campaign"}

Sending a transactional email as a triggered campaign


Users of dotmailer 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: * [Send transactional email using a triggered campaign](https://developer.dotmailer.com/docs/send-transactional-email-using-a-triggered-campaign) (REST) * [SendTransactionalEmailTriggeredCampaign](https://developer.dotmailer.com/docs/sendtransactionalemailtriggeredcampaign) (SOAP) 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 dotmailer. 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. ## 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#. [block:code] { "codes": [ { "code": "string host = \"r1-smtp.dotmailer.com\"; \n string user = \"transactionalemail-ddfe1abd8@apiconnector.com\";\n string password = \"somepassw0rd\";\n\n using (var client = new System.Net.Mail.SmtpClient(host))\n {\n client.Credentials = new System.Net.NetworkCredential(user, password);\n client.Port = 25;\n var message = new System.Net.Mail.MailMessage();\n message.To.Add(\"customer@somedomain.com\");\n message.From = new System.Net.Mail.MailAddress(\"ThisIsNotUsedInThisTypeOfTransactionalEmailCallItWillbeTakenFromTheCampaign@gmail.com\");\n message.Body = \"This is not used in this type of transactional email call. It will be taken from the campaign.\";\n message.Subject = \"This is not used in this type of transactional email call. It will be taken from the campaign.\";\n message.Headers.Add(\"X-DM-CampaignID\", \"29898234\");\n message.Headers.Add(\"X-DM-PersonalizationValues\", @\"[ \n { Name: \"\"FIRSTNAME\"\", Value: \"\"John\"\"}\n { Name: \"\"LASTNAME\"\", Value: \"\"Smith\"\"}\n ]\");\n client.Send(message);\n", "language": "csharp" } ] } [/block] Some fields must be provided according to SMPT 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 dotmailer. ## 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') ## Unsupported EasyEditor building blocks Transactional email templates don't support the following EasyEditor building blocks and link types: * 'RSS feed' * 'Sharing' * 'Social links' * 'Dynamic content' (this also includes classic dynamic content) * 'External dynamic content' * 'Advanced personalisation' blocks * 'Forward to a friend' link * 'Unsubscribe' link (but you will need to include one in order to save your template in EasyEditor; see 'About unsubscribe links' below) * 'View in browser' link * 'Double opt-in' link [block:callout] { "type": "warning", "body": "When making use of transactional email personalisation, the type of personalised content needs to be compatible with the HTML element it's being put into in EasyEditor. For example, if your code contains a personalised table, it will need to go into a table element in the template, not a paragraph. \n\nCheck with your campaign designers to ensure that their campaign's elements are suitable for the personalisation content being used.", "title": "A note on HTML compatibility for personalisation content" } [/block]