Skip to main content

How to Set Up Email for Your Site

Submitted by jessica on Fri, 02/23/2018 - 21:41

It's easy to send an email from a drupal site, because they come with contact forms that can send email ... hooray!! But making sure those emails aren't marked as phishing or spam can be a little tricky.

Here are some simple steps that should get the job done.

  1. Think of a domain name that suits your web site. For example, this web site is: drupaldesignnotes.com
  2. Go to G Suite and click "Get Started" in the top right corner. (You don't have to use G Suite, but I find their process to be the simplest.)
  3. Complete the process of buying a domain name and setting up an email address with the same domain as your web site. So if your website is mywebsite.com, your email address should be me@mywebsite.com. If your email domain is the NOT same as your web domain, any emails sent from your web site will most likely be marked as SPAM. So, it's important to make sure they match.
  4. Set up a drupal web site on your web host. (I like to use Pantheon.) Go through the installation process by following the prompts. It's pretty straightforward. Make sure the email address you use for your drupal configuration is the one you just set up: me@mywebsite.com.
  5. If you like, you can set up your contact form and then send yourself a message through it, to see what happens. If your email and web domain are the same, the email should land in your inbox, but your email might be flagged as a potential phishing email, if the from address that you entered on your contact form, is not your new email address. When other people use your contact form, of course they will use their own email address, and their messages may also be flagged as phishing emails. Moreover, if you decide to build a feature on your site that sends emails to others, whether they be receipts or e-cards, or what not, those messages will also be flagged in their inboxes. So, what can you do to fix this?
  6. Install the SMTP Authentication Support module. It allows you to use third party services, such as gmail, to send emails. These services use authentication and provide stable, outbound mail. Go to Configuration > SMTP Authentication Support and fill out the settings as follows:
    SMTP settings
    SMTP settings

     

  7. Log into your G Suite and click the top left menu button.  Go to Security > Settings. In the middle of the page, click on API Reference and check the box "Enable API access."
  8. Authenticate email with DKIM by following these instructions. Once you generate the domain key, you will have to go to your domain name host and add it as a record in their configuration screen.
  9. If you run into problems here, contact support by clicking on the question mark icon at the top right, and choosing "Contact Support." They are great and will be able to walk you through it.
  10. To make sure everything works, go to Configuration > SMTP Authentication Support, scroll to the bottom and send a test email. Try sending to an email address that is NOT the one you just set up. 
    This test email lands in the inbox and is encrypted and passes security checks.
    A good sign. This email landed in my inbox and was encrypted.

     

That's it! If you want make sure that emails sent from your site make it to inboxes, without being marked as spam or phishing, follow the steps above.