
How to Configure SMTP in Drupal (Step-by-Step Guide)
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
Or download manually from:
- Enable the module:
drush en smtp -y
2. Configure SMTP Settings
After installing and enabling the module:
Go to:
Admin → Configuration → System → SMTP Authentication Support
Or navigate directly:
/admin/config/system/smtp
- 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
- 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
Provider | SMTP Server | Port | Encryption |
---|---|---|---|
Gmail | smtp.gmail.com | 587 | TLS |
Outlook | smtp.office365.com | 587 | TLS |
Yahoo | smtp.mail.yahoo.com | 465 | SSL |
SendGrid | smtp.sendgrid.net | 587 | TLS |
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