Email SMTP
Configure your WordPress site to send emails through a proper SMTP server instead of PHP’s mail() function. This dramatically improves email deliverability, ensuring password resets, notifications, and form submissions actually reach their recipients.
Use Cases
- Fix emails not arriving or landing in spam folders
- Send WordPress emails through Gmail, SendGrid, Mailgun, or other providers
- Ensure contact form submissions and order notifications are delivered
- Set a consistent “From” name and email address for all outgoing mail
The Problem with Default WordPress Email
By default, WordPress uses PHP’s mail() function, which:
- Often gets flagged as spam by email providers
- May be completely disabled on some hosting
- Doesn’t authenticate the sender properly
- Provides no delivery confirmation or error handling
SMTP authentication solves these problems by sending emails through a legitimate mail server.
How It Works
- Configure your SMTP server credentials in the module settings
- Switchboard intercepts all WordPress emails
- Emails are sent through your SMTP provider instead of PHP mail()
- Your password is encrypted before being stored in the database
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
| SMTP Host | Text | — | Your mail server address (e.g., smtp.gmail.com) |
| SMTP Port | Number | 587 | Usually 587 for TLS or 465 for SSL |
| Encryption | Select | TLS | TLS (recommended), SSL, or None |
| Require Authentication | Toggle | On | Most SMTP servers require this |
| SMTP Username | Text | — | Usually your email address |
| SMTP Password | Password | — | Your email password or app password |
| From Email | Admin email | The sender email address | |
| From Name | Text | Site name | The sender display name |
Common SMTP Settings
Gmail / Google Workspace
| Setting | Value |
|---|---|
| SMTP Host | smtp.gmail.com |
| SMTP Port | 587 |
| Encryption | TLS |
| Username | your@gmail.com |
| Password | App Password (see below) |
Gmail requires an “App Password” instead of your regular password. Generate one at Google Account Security. You’ll need 2-factor authentication enabled.
SendGrid
| Setting | Value |
|---|---|
| SMTP Host | smtp.sendgrid.net |
| SMTP Port | 587 |
| Encryption | TLS |
| Username | apikey |
| Password | Your SendGrid API Key |
Mailgun
| Setting | Value |
|---|---|
| SMTP Host | smtp.mailgun.org |
| SMTP Port | 587 |
| Encryption | TLS |
| Username | postmaster@yourdomain.com |
| Password | Your Mailgun SMTP password |
Mailtrap (Testing)
| Setting | Value |
|---|---|
| SMTP Host | smtp.mailtrap.io |
| SMTP Port | 587 |
| Encryption | TLS |
| Username | Your Mailtrap username |
| Password | Your Mailtrap password |
Mailtrap is excellent for testing email functionality during development without sending real emails.
Testing Your Configuration
After saving your SMTP settings, use the built-in test feature:
- Enter a recipient email address (defaults to your logged-in email)
- Click “Send Test”
- Check your inbox for the test email
- If it fails, the error message will help diagnose the issue
Common test failures:
| Error | Solution |
|---|---|
| Connection timed out | Check host and port, ensure server allows outbound connections |
| Authentication failed | Verify username and password, check for app-specific passwords |
| Certificate error | Try switching encryption from TLS to SSL or vice versa |
Password Security
Your SMTP password is encrypted before being saved to the WordPress database. The encryption uses:
- AES-128-CBC encryption
- WordPress authentication keys for the encryption key
- Base64 encoding for storage
This means your password isn’t stored in plain text, providing an additional layer of security.
From Email Best Practices
The “From Email” should be:
- An email address you actually own and control
- On the same domain as your website when possible
- Configured in your email provider (SPF, DKIM records help deliverability)
Example: If your site is mycompany.com, use hello@mycompany.com rather than a personal Gmail address.
Rate Limiting
The test email feature has built-in rate limiting to prevent abuse:
- Maximum 3 test emails per 5 minutes per user
- This prevents accidental spam if someone clicks the button repeatedly
FAQ
My emails still go to spam. What else can I do?
SMTP is just one piece. For best deliverability:
- Set up SPF and DKIM records in your domain’s DNS
- Use a dedicated email service like SendGrid or Mailgun
- Ensure your “From” email matches your domain
- Avoid spammy content in your emails
Does this affect WooCommerce emails?
Yes! All WordPress emails go through this SMTP configuration, including WooCommerce order confirmations, shipping notifications, and customer emails.What if I disable the module?
WordPress will revert to using PHP’s default mail() function. Your stored SMTP settings are preserved if you re-enable the module later.Should I disable SMTP authentication?
Almost never. The “Require Authentication” toggle exists only for rare server configurations that don’t need authentication. 99% of users should leave this enabled.Get access to all 147 modules with a single license