How to Configure SMTP Module to Send Emails From Your Drupal Website?
SMTP, which stands for Simple Mail Transfer Protocol, is the standard email protocol used for sending email messages. Mail systems like AWS Simple Email Service (SES), Mandril etc allow sending emails using SMTP. If you are using Drupal and want to use external email systems that support SMTP to sent emails, SMTP module is your best friend there. In this tutorial we will be covering step by step instructions on how to install and configure SMTP module for Drupal.
The recommended way to install the SMTP Module is via composer.
composer require 'drupal/smtp'
After you install and enable the SMTP module, access the configuration page /admin/config/system/smtp.
Put this on if you want to enable SMTP email support.
SMTP Server Settings
Input the SMTP details provided by your email provider. Eg. For AWS SES, here is a documentation on how to obtain the SMTP server details
The SMTP credentials from your email service provider. Please note that, if you have already input the password and save this form before, even if the field is empty, you do not have to input password again, unless you want to change its value.
The "From" email address and "Name" that should be used for outgoing emails. If you want HTML email, the checkbox to allow to send emails formatted as HTML should be checked.
SMTP Client Settings
You can fill these fields if you want to set these to anything other than your default host host name. You can safely keep this blank if you are not sure.
Testing and Debugging
You can input an email address to sent a test email. The debug checkbox, if checked will log SMTP messages for debugging. You can read the logs from the default location - /admin/reports/dblog
If you are using a local development machine where you do not have access to an SMTP service, you can use MailHog to test email functionalities.
Zyxware is a leading Drupal development company with a team of high expertise in Drupal custom module development services since 2006.