The Telerik Platform product is retired.Learn more

Creating Email Templates Programmatically

Creating Email Templates Programmatically

In addition to the portal, you can make a POST request to the EmailTemplates RESTful API to create email templates. It is part of the metadata API.

In a JSON-formatted payload to the request provide the email template information (none of the fields is mandatory), as follows:

Field Name Description
Name An arbitrary name that you will use to identify the email template. It is used when sending emails from this template. Must be unique for the application.
FromName Full name of the sender that recipients see.
FromEmail An email address that recipients see as sender. Must be a valid email address.
ReplyToEmail Specify this if you want your users to reply to a different email address than the sender's email address. Must be a valid email address.
Cc Add a list of CC (carbon copy) recipient addresses. Each of these addresses is visible to the rest of the CC recipients.
Bcc Add a list of BCC (blind carbon copy) recipient addresses. Messages sent to BCC recipients appear as if sent only to a single recipient.
Subject The email subject that recipients see.
MessageText The email body in plain-text form. Optional.
MessageHtml The email body in HTML form. You can use HTML and CSS for styling.
SendMode Specifies in what formats to send the message body. 1=HTML, 2=text, 3=both.


var object = {
    "Subject" : "Test email subject",
    "MessageHtml" : "Sample email message.",
    "FromName": "John Smith",
    "FromEmail": "",
    "Cc" : "",
    "Bcc" : "",
    "SendMode": 1

    type: "POST",
    url: '',
    contentType: "application/json",
    headers: { "Authorization" : "Masterkey your-master-key" },
    data: JSON.stringify(object),
    success: function(data){
        alert("Email templates was successfully created.");
    error: function(error){
    Authorization: Masterkey 
    Content-Type: application/json
Payload - raw:
      "Subject" : "Test email subject",
       "MessageHtml" : "Sample email message.",
      "FromName": "John Smith",
      "FromEmail": "",
      "Cc" : "",
      "Bcc" : "",
      "SendMode": 1
    Status: 200 OK

After you have created your email template, you can use it to send emails as explained in these articles:

See Also

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.