Send Transactional Email (Personalisation)
Personalisation can be added to to a transactional email using personalisation fields, and adding corresponding tags to the transactional email HTML. If you are using a template, you can add tags to your saved template HTML.
Common fields are fields that will be personalised with the same value for all recipients in the request, while unique fields are mapped to each recipient email address and will be personalised with the value mapped to that email address in the request.
Endpoint
Method | URL |
---|---|
POST | https://api.everlytic.net/transactional/email/v1/mail |
Request Body
{ "headers" : { "subject": "Personalisation", "to": [ { "email": “[email protected]", "name": “Joe”} ], "from" : { "email": “[email protected]", "name": “John”} }, "options": { "track_links": true, "track_opens": true } , "body": { "personalisation_fields": { "common_fields": { "common_personalisation_field" : "Common value"}, "unique_fields": [ { “[email protected]": {"unique_personalisation_field" : "Unique value"} } ] }, "html" : "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\"> <head> <title>Acccount Statement</title> <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /> <style type=\"text/css\"> body { width: 100%; background-color: #ffffff; margin:0; padding-top:10px; font-family: Century Gothic Regular, Century Gothic; font-size: 13px; color: #004C97; text-align:justify; line-height: 150%; } .col { width: 100%; height: 100%; float: left; padding: 10px; text-align: center; } @media only screen and (min-width:601px) { .col { width: 30%; } } a { text-decoration: none; color: #2F5597; outline : none; } a img { outline : none; } img { border : 0; } </style> </head> <body margin-left=\"0\" margin-top=\"0\" marginwidth=\"0\" marginheight=\"0\" yahoo=\"fix\" style=\"background-color: #ffffff;\"> <br> Example HTML <br> A Common personalisation field: {{common_personalisation_field}} <br> A unique personalisation field: {{unique_personalisation_field}} </html>" } }
Example Request
curl --location 'https://api.everlytic.net/transactional/email/v1/mail' \ --data-raw '{ "headers" : { "subject": "Personalisation", "to": [ { "email": “[email protected]", "name": “Joe”} ], "from" : { "email": “[email protected]", "name": “John”} }, "options": { "track_links": true, "track_opens": true } , "body": { "personalisation_fields": { "common_fields": { "common_personalisation_field" : "Common value"}, "unique_fields": [ { “[email protected]": {"unique_personalisation_field" : "Unique value"} } ] }, "html" : "
Example HTML A Common personalisation field: {{common_personalisation_field}} A unique personalisation field: {{unique_personalisation_field}} " } }'
Example Response
Email was sent successfully [200 OK]
{ "transactions": [ { "id": "1441b97a-0578-482e-8f48-b61ac98db717" } ] }