Use a free email service: Sendgrid
First, you need to create an account with Sendgrid. This is a service that allows you to send transactional emails from any website. The advantage is that Sendgrid is free if you send less than 100 emails per day from your Drupal website. For the average Drupal website, this is usually more than enough. Only when you have a community or intranet website with many users is there a chance that you'll exceed this limit. This is because you'll be sending emails like updates on what's happening within the community or for users who sign up or forget their passwords. This quickly adds up.
- Create an account on Sendgrid
- Login to Sendgrid
- On the left, choose 'Settings > API Keys'
- Click on the 'Create API Key' button in the upper right
- Enter a name for the API key. You can choose any name that is recognizable to you, such as the name of your Drupal website
- Select 'Full Access' and click on the 'Create and view' button in the lower right
- Next, you'll see a long string of characters. You'll need this when setting up your Drupal website, so copy it (by clicking on the string) and save it somewhere
- Click on the 'Done' button
SMTP module for Drupal
Next, we will install and configure the SMTP module, which replaces and enhances Drupal's built-in PHP mail function.
- Install the SMTP module. Learn more about installing Drupal modules.
- To enable the SMTP module, navigate to 'Extend > Install new module' in the Drupal backend.
- To configure the SMTP module, go to 'Configuration > System > SMTP Authentication Support.'
- Set 'SMTP as the default mailsystem' to 'On.'
- For 'SMTP server,' enter 'smtp.sendgrid.net.'
- Choose '587' as the SMTP port.
- Under 'SMTP Authentication,' enter 'apikey' as the 'Username' and paste the string of characters copied from Sendgrid under 'Password.'
- Optionally, you can choose to send emails as HTML (for a neater appearance) by checking 'Allow to send e-mails formatted as HTML.'
- To verify that everything is filled out correctly, you can send a test email immediately by entering your own email address under 'E-mail address to send a test email to.'
- Click 'Save configuration.'
If everything went well, you will now receive a test email, and from now on, all emails sent from the Drupal website will be delivered.
If you have any questions or comments about the above, please let me know by leaving a comment below.