Connecting to Email Services

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsConnecting to Email Services

AWS SES

To create a service for connecting to Amazon SES (Simple Email Service), follow these steps.

  • Go to the Services tab in the admin console.
  • Click Create.
  • Set the Service Type to AWS SES.
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Go to the Config tab for the new service.
  • Enter your AWS access key, secret key, and region.
  • Click Create Service to save your new service.
  • Go to the API Docs tab in the admin console to test your new service.

Local Email Service

To create a service for connecting to local email, follow these steps.

  • Go to the Services tab in the admin console.
  • Click Create.
  • Set the Service Type to Local Email Service.
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Click Create Service to save your new service.
  • Go to the API Docs tab in the admin console to test your new service.

Note: By default DreamFactory uses 'sendmail' for Local Email Service. You can change this in the .env file by changing the 'MAIL_DRIVER' option. Valid options for 'MAIL_DRIVER' are 'smtp', 'mail', 'sendmail', 'ses', 'mailgun', 'mandrill'. If you choose 'smtp' as Local Email Service driver then see config/mail.php for SMTP configuration. If you choose 'ses', 'mailgun', or 'mandrill' as the driver then see config/services.php for configuration options.

Mailgun Email Service

To create a service for connecting to Mailgun email, follow these steps.

  • Go to the Services tab in the admin console.
  • Click Create.
  • Set the Service Type to Mailgun Email Service.
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Go to the Config tab for the new service.
  • Enter your Mailgun Domain and API Key. Please note that the domain for sandboxed MailGun accounts will not be the full endpoint URL. Only a portion of the mailgun settings is used here, such as: sandboxcea7db2128824e8c9e360d8f5fb6dd09.mailgun.org
  • Click Create Service to save your new service.
  • Go to the API Docs tab in the admin console to test your new service. If you want to send a simple plain-text e-mail, the request body will look like this:
{
  "to": [
      {
        "name": "John Smith",
        "email": "[email protected]"
      }
    ],
    "subject": "This is a test e-mail",
    "body_text": "This is a test e-mail",
    "from_name": "Jane Doe",
    "from_email": "[email protected]",
    "reply_to_name": "Jane Doe",
    "reply_to_email": "[email protected]"
}

If you're using the Mailgun sandbox, you'll need to first add an authorized recipient to your sandbox account. You can do this via your Mailgun sandbox account settings.

Mandrill Email Service

To create a service for connecting to Mandrill email, follow these steps.

  • Go to the Services tab in the admin console.
  • Click Create.
  • Set the Service Type to Mandrill Email Service.
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Go to the Config tab for the new service.
  • Enter your Mandrill API Key.
  • Click Create Service to save your new service.
  • Go to the API Docs tab in the admin console to test your new service.

SMTP Email Service

To create a service for connecting to SMTP email, follow these steps.

  • Go to the Services tab in the admin console.
  • Click Create.
  • Set the Service Type to SMTP Email Service.
  • Enter a name and label for the service. Name will be part of the URL for accessing the service via the REST API.
  • Go to the Config tab for the new service.
  • Enter your Host, Port (default: 587), Encryption (default: tls), Username, Password.
  • Click Create Service to save your new service.
  • Go to the API Docs tab in the admin console to test your new service.