Starting on September 30, 2024, Google no longer allows you to enable the less secure apps. Learn how to add app-specific passwords for your Google Account.
Sending Drupal 10 website Emails through Googles SMTPTo ensure your Drupal 10 website can send emails, like password reset links, you must configure the SMTP Module, especially after Google’s policy change on September 30, 2024, which prohibits the use of less secure apps. This guide will show you how to set up the SMTP Module in Drupal 10 for sending password reset emails and other form submissions via Gmail.
Before you begin, ensure you have the necessary tools. You will need Composer and Drush installed on your computer. Additionally, you must have access to a Gmail account and its password, which will be used to send the emails. Follow these steps to configure SMTP in Drupal 10, ensuring your site’s email functionality is uninterrupted by Google’s security updates.
Note: The instructions below are for a standard Gmail and have not been tested on a Google Workspace email address.
Download and Enable the Module
- First, you must download and enable the module.
- We are going to use composer to download and then a drush command to enable it. Or you could just enable the module in the
drush en smtp -y
Configure the SMTP Module in Drupal
- Navigate to the configuration page admin/config/system/smtp
- Under Turn this module on or off select On.
- Under SMTP server enter the following smtp.gmail.com. Leave SMTP backup server blank
- Under SMTP port enter 587
- Under Use encrypted protocol select Use TLS
- Under E-MAIL OPTIONS use the same Gmail address as you did above and enter an E-mail from name
Update Gmail Account Settings
- Login to your Gmail account at https://myaccount.google.com/
- On the account homepage, click Sign-in & security or navigate to https://myaccount.google.com/security
- Turn on 2-factor authentication and enter your phone numbers
Create App-Specific Password for GMAIL
- Visit https://myaccount.google.com/apppasswords
- Name your app — XYZ Drupal Website
- Copy the password and enter this password into the SMTP Module password location.
How to Configure the SMTP Module in Drupal 10 with Gmail, Since Google Removed Less Secure Apps was originally published in Drupal Atlanta on Medium, where people are continuing the conversation by highlighting and responding to this story.