drupal-smtp

How to Configure SMTP in Drupal (Step-by-Step Guide)

  • Profile picture of Mcs
  • by Mcs July 1, 2025

Step-by-Step Guide to Configure SMTP in Drupal

1. Install the SMTP Authentication Support Module

You need the SMTP Authentication Support module.

  • Download via Composer (recommended for Drupal 8+):

composer require drupal/smtp

drush en smtp -y

2. Configure SMTP Settings

After installing and enabling the module:

  1. Go to:

    Admin → Configuration → System → SMTP Authentication Support

    Or navigate directly:

    /admin/config/system/smtp

  2. Fill in the SMTP details:
    • SMTP server: e.g., smtp.gmail.com
    • SMTP port: 465 (SSL) or 587 (TLS)
    • Use encrypted protocol: TLS or SSL
    • SMTP authentication: Check this box
    • Username: Your email (e.g., you@example.com)
    • Password: Your email password (or App Password if 2FA is on)
    • Email from address: Your site’s sender email
    • Email from name: Your site name
  3. Click Save Configuration

3. Test Email Sending

At the bottom of the SMTP config page, use the test email form:

  • Enter your email
  • Click Send test email

If configured correctly, you’ll receive a test message in your inbox.

4. Set SMTP as Default Mail System

Go to:

Configuration → System → Mail System

(/admin/config/system/mailsystem)

Set:

  • Default Mail System: SMTPMailSystem

Click Save Configuration

Notes on Using Gmail SMTP

If you're using Gmail:

  • Enable "Less secure apps" (not recommended anymore) or
  • Use App Passwords (recommended if 2FA is enabled)

Common SMTP Servers

ProviderSMTP ServerPortEncryption
Gmailsmtp.gmail.com587TLS
Outlooksmtp.office365.com587TLS
Yahoosmtp.mail.yahoo.com465SSL
SendGridsmtp.sendgrid.net587TLS

Conclusion

Configuring SMTP in Drupal is essential for ensuring that your website can reliably send emails — whether it's for user registrations, contact forms, or system alerts. By using the SMTP Authentication Support module, you can securely route outgoing emails through trusted services like Gmail, SendGrid, or Mailgun. Proper SMTP setup not only improves email deliverability but also reduces the chance of messages being marked as spam.

Comments

Add new comment

Restricted HTML

  • Allowed HTML tags: <br> <p> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <cite> <dl> <dt> <dd> <a hreflang href> <blockquote cite> <ul type> <ol type start> <strong> <em> <code> <li>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.