Sending Email
(Created page with "### Tutorial 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 c...") |
|||
Line 1: | Line 1: | ||
− | + | === Tutorial === | |
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 using various email service providers from your DreamFactory 2.0 instance once they are provisioned. | ||
Line 10: | Line 10: | ||
* SMTP | * SMTP | ||
− | + | === 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. Login to the admin console and select the 'Services' tab. Click | ||
Line 22: | Line 22: | ||
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. | ||
− | + | === API Endpoints === | |
<pre>POST https://{url}/api/v2/{email_service_name}</pre> | <pre>POST https://{url}/api/v2/{email_service_name}</pre> | ||
Line 58: | Line 58: | ||
</source> | </source> | ||
− | + | === Example - Sending email using a template === | |
* Email service name: mailer | * Email service name: mailer | ||
Line 91: | Line 91: | ||
<pre>POST https://foo.com/api/v2/mailer</pre> | <pre>POST https://foo.com/api/v2/mailer</pre> | ||
− | + | === Example - Sending email using an in-load data === | |
* Email service name: mailer | * Email service name: mailer |
Revision as of 18:03, 3 February 2016
Contents
Tutorial
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
- Mailgun
- Mandrill
- Local sendmail
- SMTP
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 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