Documentation

SMTP

Servd offers a direct integration with ElasticEmail to provide almost-zero-config email deliverability for transactional emails.

We've partnered with ElasticEmail to offer this service for free for all subscribed projects, with optional addons to increase the number of emails that you can send per month.

Getting Started #

  1. Visit your project's SMTP page in the dashboard.

  2. Enter the email address, password and sending domain that you'd like to use for your new ElasticEmail account. The sender domain needs to match the domain of the email address you'll be sending emails from.

    You'll use these details to log into ElasticEmail in the future if you ever need to review your email analytics.

  3. We'll set up your ElasticEmail account and get everything configured for you in the background.

  4. Sync your project to deploy the below environment variables. 👇

Configuring Craft #

Once your SMTP account is enabled Servd will automatically begin adding the following environment variables to all of your environments:

SERVD_SMTP_HOSTNAME
SERVD_SMTP_PORT
SERVD_SMTP_USERNAME
SERVD_SMTP_PASSWORD

We can use these within Craft's Email settings in order to get everything up and running.

If you're using Craft's 'Project Config' you'll need to perform the following steps in your local development environment:

  1. Visit your SMTP settings page, select the "View .env snippet" option from the dropdown at the top right of the page and copy the snippet into your local .env file.

  2. Visit the Craft Control Panel for your locally running project and navigate to the Settings > Email page.

  3. Check that the System Email Address uses an email that matches the 'Sending Domain' you configured for your ElasticEmail account earlier.

  4. Add the following additional configuration details:

    Reply-To Address: Any address that you'd like replies to be sent to.

    Sender Name: The name you'd like to appear as the Sender on your emails.

    Transport Type: SMTP

    Host Name: $SERVD_SMTP_HOSTNAME

    Port: $SERVD_SMTP_PORT

    Use authentication: Yes

    Username: $SERVD_SMTP_USERNAME

    Password: $SERVD_SMTP_PASSWORD

    Encryption Method: TLS

    Timeout: 10

  5. Hit 'Test' and an email should be successfully sent to the email address for the user you have used to log into the Craft Control Panel.

Verifying Your Domain (DKIM, SPF, DMARC) #

In order to get emails into your recipient's inboxes, and not flagged as spam, you'll need to set up DKIM, SPF and DMARC, but don't worry! It's simply a case of adding a few DNS records to your sending domain.

The records you need to add can be found in your project's SMTP page. As every DNS provider is a little different, please refer to your DNS provider's documentation for detailed instructions on how to add these records to your account.

Once they have been added, return to the Servd dashboard and click the 'Verify' button next to each of the records to check that they have been set and activate their associated functionality.

If you already have SPF records set

If you're already sending emails from the same domain via another platform, you might already have SPF DNS records defined. If that is the case do not delete the existing ones. Instead you can combine the contents of the existing record with the new value from the Servd Dashboard.

For example, if your domain already has the record: v=spf1 a mx include:_spf.google.com ~all, then you would just add: include:_spf.elasticemail.com.

The final record would look like this: v=spf1 a mx include:_spf.google.com include:_spf.elasticemail.com ~all.

Managing DMARC Reports #

When you setup DMARC, you may start receiving emails from external email providers containing reports on what they've received from your domain. This is a key part of DMARC as it allows recipient providers to let you know if they're receiving spam from your domain.

Reports are sent to the email address included in the value of your _dmarc DNS record, specifically the ruf and rua keys. By default, Servd includes the email you provided when setting up your ElasticEmail SMTP account, but you are free to change this to a more appropriate address should you prefer.

To help you make sense of the reports, we recommend using Postmark's free DMARC monitoring tool. It generates you a special email address which, when added to your DMARC DNS record, will start receiving and digesting reports from providers. They then deliver the information in a more user-friendly format so you can understand how your domain is being used.

Troubleshooting #

If you are seeing an error like this in the project logs when sending an email...

Expected response code 250 but got code "553", with message "553 Envelope FROM 'from@example.com' email address not allowed.

...then there is likely a mismatch between the sender domain that was entered when creating the SMTP account and the "from" email address being used to send the email. The sender domain needs to match the domain of the "from" email address, so to rectify the error, we suggest changing the "from" email address to match it.

If you'd prefer to change the sender domain instead, get in touch via our support and we can update it for you. Alternatively, you can delete the SMTP account in the project's SMTP settings and create a new one with the correct sender domain, and then sync the project to receive the new SMTP credentials in the SERVD_SMTP environment variables. Either way you choose, the new domain will require SPF, DKIM and DMARC DNS records to be updated to it to avoid emails being marked as spam.