Reliable Email Deliverability

Return on Development

One of the challenges with setting up a new WordPress site is how to handle email. Let’s talk about how to do this professionally.

Out of the box, WordPress will use the default mail() function. In some instances, on some hosting providers, this may work. However, most likely you’re email provider (such as Gmail or Microsoft O365) will block emails sent from the mail() function.

Email providers block emails sent this way because they are often used to spam. To send emails reliably from your website you’ll need to utilize a provider that can help you do that.

If I’m using AWS, I recommend Amazon SES. Mailgun has also been helpful.

Both of these services will reliably send email for you — the downside is that they can be complicated to set up.

Here is the basic strategy for setting up an email account provider:

  1. Create the domain accounts on the system, such as Mailgun or SES
    1. For AWS SES, you’ll need to verify an email to receive emails. Initial accounts are “sandboxed” and you will be unable to send emails to everyone without upgrading your account from the sandbox
    2. You can operate in this sandbox mode if you’re only sending emails to yourself, but if you need to send to other people (such as confirmation emails), you’ll need to upgrade from the sandbox
  2. Modify your DNS to add required records to send emails
  3. Modify your WordPress installation to use the new credentials — use a plugin like Fluent SMTP that will help you configure your WordPress mail settings and provide a log of emails in the event that there is an issue with your mailing provider

The challenge with Amazon SES’s service is with the connection details. To create an SMTP account that you’ll input into Fluent SMTP, you need to:

  1. Go to the “Account Dashboard” in SES
  2. Note the “SMTP endpoint”, “STARTTLS Port” and “Transport Security Layer (TLS)” options — this will be used for setting up Fluent SMTP
  3. Click on the “Create SMTP Credentials” button
  4. This will start a process that creates an IAM user with the ability to send email via SES
  5. NOTE: You will only receive the SMTP username and SMTP password once when setting up this user. You will use those details to connect in Fluent SMTP. Do not use the IAM user name or the IAM password (SDK details)!

If this seems like a lot of steps, you’re correct. It is. You may be able to get away with fewer — simply having Fluent SMTP send email using the default settings may work and provide you with an email log. However, if it doesn’t — you’ll need to utilize a professional service.

These services exist due to the problem of spam. SES and Mailgun force you to configure your domain and validate your identity so they can track your usage. If you’re spamming people, their service will get penalized and you’ll get shut out. The whole setup is designed to prevent people from using mail to send unwanted email. This unfortunately adds a lot of trouble in initial mail setup.

But once it works, you can generally let it go without another thought.

© 2024 Return on Development, Seth Hayward