Setting up email templates

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsSetting up email templates
m (Minor formatting of JSON block that was malformed)
Line 19: Line 19:
 
<source lang="JavaScript">
 
<source lang="JavaScript">
 
{
 
{
     "resource":[
+
     "resource": [
 
         {
 
         {
"name": "",
+
            "name": "",
"description": "",
+
            "description": "",
"to": "",
+
            "to": "",
"cc": "",
+
            "cc": "",
"bcc": "",
+
            "bcc": "",
"subject": "",
+
            "subject": "",
"body_text": "",
+
            "body_text": "",
"body_html": "",
+
            "body_html": "",
"from_name": "",
+
            "from_name": "",
"from_email": "",
+
            "from_email": "",
"reply_to_name": "",
+
            "reply_to_name": "",
"reply_to_email": ""
+
            "reply_to_email": ""
}
+
        }
 
     ]
 
     ]
 
}
 
}

Revision as of 23:04, 5 May 2016

Tutorial

DreamFactory supports email templates that you can use in your email sent out by the email services. You can setup email templates using the admin console as well as using API Endpoints.

Setup Email Templates using admin console.

Login to the admin console and click on the 'Config' tab. Click on 'Email Templates' from the left navigation menu. The 'Email Templates Overview' form lets you create a new template as well as edit an existing template. You can edit an existing template by selecting it from the '-- Select Email Template --' drop down box. Or click on the [+] (plus) button to create a new template. Fill in the template form and create your template.

API Endpoints

Creating new Email Template

POST http://{url}/api/v2/system/email_template

Request Body:

{
    "resource": [
        {
            "name": "",
            "description": "",
            "to": "",
            "cc": "",
            "bcc": "",
            "subject": "",
            "body_text": "",
            "body_html": "",
            "from_name": "",
            "from_email": "",
            "reply_to_name": "",
            "reply_to_email": ""
        }
    ]
}

Editing an existing Email Template

PATCH http://{url}/api/v2/system/email_template/{template_id}

Request Body:

{
    "name": "",
    "description": "",
    "to": "",
    "cc": "",
    "bcc": "",
    "subject": "",
    "body_text": "",
    "body_html": "",
    "from_name": "",
    "from_email": "",
    "reply_to_name": "",
    "reply_to_email": ""
}

Example - Creating a new Email Template

  • Request Body:
{
    "resource":[
        {
            "name": "sales",
            "description": "An email template for sending out sales email.",
            "to": "[email protected]",
            "cc": "[email protected]",
            "bcc": "[email protected]",
            "subject": "Weekly sales report",
            "body_text": "Text body goes here",
            "body_html": "Html body goes here",
            "from_name": "Jane Doe",
            "from_email": "[email protected]",
            "reply_to_name": "Jane Doe",
            "reply_to_email": "[email protected]"
        }
    ]
}
  • Request URL:
POST http://foo.com/api/v2/system/email_template

Example - Editing an existing Email Template

  • ID of the template to edit: 1
  • Request Body:
{
    "name": "sales",
    "description": "An email template for sending out sales email.",
    "to": "[email protected]",
    "cc": "[email protected]",
    "bcc": "[email protected]",
    "subject": "Weekly sales report",
    "body_text": "Text body goes here",
    "body_html": "Html body goes here",
    "from_name": "Jane Doe",
    "from_email": "[email protected]",
    "reply_to_name": "Jane Doe",
    "reply_to_email": "[email protected]"
}
  • Request URL:
PATCH http://foo.com/api/v2/system/email_template/1

Example - Editing a single field of an existing Email Template

  • ID of the template to edit: 1
  • Field to edit: from_email
  • Request Body:
{
    "from_email": "[email protected]"
}
  • Request URL:
PATCH http://foo.com/api/v2/system/email_template/1