Drupal 9 SMTP Configuration: From scratch use SMTP and configure with an outlook account.

Saira Bano
3 min readOct 6, 2022

--

In this article, you will learn how to configure SMTP with drupal 9 and the required setting changes for an outlook account in order to send emails.

Step 1: Install the SMTP module using the composer command

composer require 'drupal/smtp:^1.1'

Step 2: After installing the module, enable the SMTP module from extend, Drupal settings.

Step 3: Once the module is enabled, SMTP configuration is required. For those navigate to Configuration-> System -> SMTP Authentication Support.

For using outlook we have to provide respective outlook SMTP configuration data and change a few settings in order to send emails.

Follow the below steps:

  1. Login to your outlook account.
  2. Open your Outlook settings.
outlook smtp settings

3. Navigate to Sync email and select option “Yes” from the POP and IMAP options.

outlook smtp settings

4. Scroll down and find SMTP settings, and enter this data into your SMTP Authentication configuration.

outlook smtp settings

Now let’s get back to the drupal side, our work is finished here.

Step 4: After navigating to Configuration-> System -> SMTP Authentication Support. Select “On” from the install options and enter SMTP Server (smtp.office365.com), SMTP port (587), Use encrypted protocol (use TLS), and Enable TLS encryption automatically (On).

drupal SMTP configuration

Step 5: In SMTP Authentication, enter your user “email address” in the username and your email account password in the password field. Make sure both email and password credentials are correct.

In E-MAIL Options, enter the same email address and name from which your email will be sent.

drupal SMTP configuration

In SEND TEST E-MAIL, enter the email where you want to receive the test email.

Enable debugging is optional, but helps in debugging the problem and displays messages.

drupal SMTP configuration

Now click save the configuration.
A test e-mail has been sent successfully to your provided email address.

drupal SMTP configuration test email

Your SMTP configuration setup is complete, Voila!

Note: In some cases email is not sent and error is displayed because bydefault drupal is using site’s email address. For that navigate to Configuration->Syestem->Basic site settings. In Site Details, enter your same smtp configured email in email address field and save confriguation. Make sure to use same email address at both places. If the sending email or from email is different then in result email won’t be sent.

--

--