Setup SMTP Server for Trellis Using Sendgrid

When using Trellis, you have to setup your own SMTP server to send outgoing email for you. For example, if someone submits a contact form on your site and you want WordPress to send an email notifying them, you’ll need an SMTP server setup.

I’m using Sendgrid for now. They’re a little more technical, but they have a great reputation. Only red flag I’ve seen is that I tried to signup for multiple account and they told me some were not approved. Not sure if the domain reputation was blacklisted or what. Anyhow, I’ve got an account setup that I may be able to use as an agency account for all domains so I’m giving it a try.

 

  1. Get started: https://app.sendgrid.com/guide
  2. To setup additional whitelist domains go to: https://app.sendgrid.com/settings/whitelabel
    • I haven’t figured out how these are used yet.
  3. To get SMTP info go to: https://app.sendgrid.com/guide/integrate/langs/smtp (note: port 587 is recommended, and works for me even though it’s not SSL)
  4. Once the API is created, you cannot view the key, so copy it and save it to your group_vars/all/vault.yml immediately (here’s how to do that if it’s encrypted– Trellis Security)
  5. For testing with Mailhog, vagrant provision the server
  6. Once ready for staging/production, provision the remote server and test.

Leave a Reply