Sending Email

From DreamFactory
Jump to: navigation, search
Line 1: Line 1:
You can send out emails using various email service providers from your DreamFactory 2.0 instance once they are provisioned.  
+
You can send out emails from your DreamFactory instance using various email service providers.
The following email providers are currently supported on DreamFactory 2.0.
+
The following email providers are currently supported:
  
 
* AWS SES
 
* AWS SES
Line 10: 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,  
+
Log in to the admin console and select the 'Services' tab. Click on the 'Create' button from the left menu.  
let's say we name our email service 'mailer'.
+
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]]
 
[[File:Tutorial sending email.png|200px]]

Revision as of 21:44, 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'.

Tutorial sending email.png

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: [email protected]
  • Email subject: A test email
  • Email body: This is a test email
  • From name: Jane Doe
  • From email: [email protected]
  • Reply to name: Jane Doe
  • Reply to email: [email protected]
  • Request body:
{
  "template": "newsletter",
  "to": [
    {
      "name": "John Doe",
      "email": "[email protected]"
    }
  ],
  "subject": "A test email",
  "body_text": "This is a test email",
  "from_name": "Jane Doe",
  "from_email": "[email protected]",
  "reply_to_name": "Jane Doe",
  "reply_to_email": "[email protected]"
}
  • 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: [email protected]
  • 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: [email protected]
  • Reply to name: Jane Doe
  • Reply to email: [email protected]
  • Request body:
{
  "to": [
    {
      "name": "John Doe",
      "email": "[email protected]"
    }
  ],
  "subject": "A test email",
  "body_text": "Hi {name}, This is a test for {service} service.",
  "from_name": "Jane Doe",
  "from_email": "[email protected]",
  "reply_to_name": "Jane Doe",
  "reply_to_email": "[email protected]",
  "name":"John",
  "service":"mailer"
}
  • Request URL:
POST https://foo.com/api/v2/mailer