Sending Email

From DreamFactory
Jump to: navigation, search
(Provisioning an Email Service)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=== Tutorial ===
+
You can send out emails from your DreamFactory instance using various email service providers.
 
+
The following email providers are currently supported:
You can send out emails using various email service providers from your DreamFactory 2.0 instance once they are provisioned.  
+
The following email providers are currently supported on DreamFactory 2.0.
+
  
 
* AWS SES
 
* AWS SES
Line 12: Line 10:
 
=== Provisioning an Email Service ===
 
=== Provisioning an Email Service ===
  
You can provision an email service from the admin console. Login to the admin console and select the 'Services' tab. Click
+
You can provision an email service from the admin console.  
on the 'Create' button from the left menu. On the service creation form select your email provider from the 'Service Type'
+
drop down box. Enter a short, one-word, meaningful name for your service as well as a label and description. For this tutorial,
+
let's say we name our email service 'mailer'.
+
  
[[File:Tutorial sending email.png|200px]]
+
Log in to the admin console and select the 'Services' tab. Click on the 'Create' button from the left menu.
 +
On the service creation form, select your email provider from the 'Service Type' drop down box.
 +
Enter a short, one-word, meaningful name for your service as well as a label and description.  
  
Depending on which provider you pick, you will need to enter the service configuration values on the 'Config' tab. Create your
+
For this tutorial, let's say we name our email service 'mailer'. Depending on which provider you pick, you will need to enter the service configuration values on the 'Config' tab. Create your
 
email service after entering all your configuration values. Your email service is now ready to send out emails.
 
email service after entering all your configuration values. Your email service is now ready to send out emails.
  

Latest revision as of 21:45, 15 July 2016

You can send out emails from your DreamFactory instance using various email service providers. The following email providers are currently supported:

  • AWS SES
  • Mailgun
  • Mandrill
  • Local sendmail
  • SMTP

Provisioning an Email Service

You can provision an email service from the admin console.

Log in to the admin console and select the 'Services' tab. Click on the 'Create' button from the left menu. On the service creation form, select your email provider from the 'Service Type' drop down box. Enter a short, one-word, meaningful name for your service as well as a label and description.

For this tutorial, let's say we name our email service 'mailer'. Depending on which provider you pick, you will need to enter the service configuration values on the 'Config' tab. Create your email service after entering all your configuration values. Your email service is now ready to send out emails.

API Endpoints

POST https://{url}/api/v2/{email_service_name}

Request body:

{
  "template": "",           // (Optional) Email template name if any.
  "template_id": 0,         // (Optional) Email template ID if any.
  "to": [
    {
      "name": "",
      "email": ""
    }
  ],
  "cc": [
    {
      "name": "",
      "email": ""
    }
  ],
  "bcc": [
    {
      "name": "",
      "email": ""
    }
  ],
  "subject": "",
  "body_text": "",
  "body_html": "",
  "from_name": "",
  "from_email": "",
  "reply_to_name": "",
  "reply_to_email": ""
}

Example - Sending email using a template

  • Email service name: mailer
  • Email template name: newsletter
  • Recipient's name: John Doe
  • Recipient's email: jdoe@example.com
  • Email subject: A test email
  • Email body: This is a test email
  • From name: Jane Doe
  • From email: jane.doe@example.com
  • Reply to name: Jane Doe
  • Reply to email: jane.doe@example.com
  • Request body:
{
  "template": "newsletter",
  "to": [
    {
      "name": "John Doe",
      "email": "jdoe@example.com"
    }
  ],
  "subject": "A test email",
  "body_text": "This is a test email",
  "from_name": "Jane Doe",
  "from_email": "jane.doe@example.com",
  "reply_to_name": "Jane Doe",
  "reply_to_email": "jane.doe@example.com"
}
  • Request URL:
POST https://foo.com/api/v2/mailer

Example - Sending email using an in-load data

  • Email service name: mailer
  • Recipient's name: John Doe
  • Recipient's email: jdoe@example.com
  • Email subject: A test email
  • Email body: Hi {name}, This is a test for {service} service.
  • name = 'John'
  • service = 'mailer'
  • From name: Jane Doe
  • From email: jane.doe@example.com
  • Reply to name: Jane Doe
  • Reply to email: jane.doe@example.com
  • Request body:
{
  "to": [
    {
      "name": "John Doe",
      "email": "jdoe@example.com"
    }
  ],
  "subject": "A test email",
  "body_text": "Hi {name}, This is a test for {service} service.",
  "from_name": "Jane Doe",
  "from_email": "jane.doe@example.com",
  "reply_to_name": "Jane Doe",
  "reply_to_email": "jane.doe@example.com",
  "name":"John",
  "service":"mailer"
}
  • Request URL:
POST https://foo.com/api/v2/mailer