keepcalculator

06 Numbers and Powers

Fix WordPress SMTP Email Problems on a VPS

Card No. 06·15408 · Updated · Standard formula, shown below

If your WordPress site is running on a VPS and emails are not being delivered (or not sent at all), the usual culprit is the default PHP mail() function, which is often misconfigured or blocked on cloud servers. This guide shows you how to set up SMTP (Simple Mail Transfer Protocol) so your site sends reliable, authenticated email through an external mail server like Gmail, Outlook, or your domain’s email provider.

What You’ll Need

  • Admin access to your WordPress dashboard
  • FTP/SSH access to your VPS (or a file manager in your hosting panel)
  • An SMTP server address, port, and credentials (for example, from your email provider or a transactional email service)
  • A plugin like WP Mail SMTP, Post SMTP, or Easy WP SMTP (we’ll use WP Mail SMTP in this guide)

Step-by-Step

  1. Back up your site – Before making any changes, take a full backup of your WordPress files and database. Most VPS control panels have a backup tool, or you can use a plugin.
  2. Install an SMTP plugin – In your WordPress admin, go to Plugins → Add New, search for “WP Mail SMTP�, install and activate it. This plugin is widely used and free.
  3. Open the SMTP settings – After activation, go to WP Mail SMTP → Settings. You’ll see a “Mailerâ€� section with several options.
  4. Choose your mailer – Select “Other SMTP� (or “Sendinblue� or “Mailgun� if you use those services). For a generic SMTP server, choose “Other SMTP�.
  5. Enter SMTP details – Fill in the following fields:
    • From Email: The email address that will appear in the “Fromâ€� line. Use a real address from your domain or provider.
    • From Name: Your site name or your name.
    • Mailer: Set to “Other SMTPâ€�.
    • SMTP Host: The hostname of your SMTP server (e.g., smtp.gmail.com or mail.yourdomain.com).
    • SMTP Port: Usually 587 (with STARTTLS) or 465 (SSL). Check with your provider.
    • Encryption: Choose “TLSâ€� for port 587, “SSLâ€� for port 465, or “Noneâ€� if your server uses plain text (not recommended).
    • Authentication: Turn ON “Use SMTP authenticationâ€�.
    • Username: Your full email address (e.g., user@yourdomain.com).
    • Password: The password for that email account or an app-specific password if required.
  6. Save and test – Click “Save Settingsâ€�. Then go to WP Mail SMTP → Tools (or the “Email Testâ€� tab) and send a test email to your own address. If it arrives, you’re done. If not, move to the troubleshooting section.
  7. Force SMTP from your theme/plugins – Some plugins (like Contact Form 7 or WooCommerce) have their own mail settings. In WP Mail SMTP, you can enable “Force From Emailâ€� and “Force From Nameâ€� to override them. Also, some plugins have a “Send all WordPress emails via SMTPâ€� option – make sure it’s enabled.
  8. Optional: Use a transactional email service – If your site sends many emails (e.g., membership sites, e-commerce), consider using a service like SendGrid, Mailgun, or Amazon SES. These integrate with WP Mail SMTP and are more reliable for high volume.

Common Mistakes

  • Wrong port or encryption – Using port 465 with TLS instead of SSL, or 587 with SSL instead of TLS, is a frequent error. Check your provider’s documentation.
  • Using your cPanel email password – Some hosts require an “app passwordâ€� for SMTP, especially if you have two-factor authentication enabled.
  • Not updating the “Fromâ€� address – If the From email doesn’t match your SMTP username, some servers reject the email.
  • Plugins overriding SMTP – Contact form plugins often have their own mail settings. Make sure they are set to use WordPress’s default mail function, which will then use SMTP.
  • Firewall blocking the port – Your VPS firewall may block outbound connections on port 25, 465, or 587. Check your firewall rules.

Tips

  • Use a dedicated email address – Create an email like no-reply@yourdomain.com for transactional emails. This avoids mixing with personal mail.
  • Enable logging – WP Mail SMTP has a “Email Logâ€� feature. Turn it on to see if emails are being sent and any error messages.
  • Keep your SMTP credentials secure – Store them in your wp-config.php file using constants if you prefer not to keep them in the database (the plugin supports this).
  • Test with a disposable email – Use a temporary email service to test without cluttering your inbox.
  • Use a CDN or external mail relay – If your VPS IP is blacklisted (common with shared IPs), using a provider like SendGrid can improve deliverability.

Troubleshooting

If the test email fails, follow these steps:

  1. Check the error message – In WP Mail SMTP, the test will show a debug message. It often says “SMTP Error: Could not authenticate� or “Connection refused�.
  2. Verify your SMTP server is reachable – From your VPS terminal, run telnet smtp.yourprovider.com 587. If it times out, your firewall is blocking it. Open the port in your firewall (e.g., ufw allow 587).
  3. Test with a different port – Try port 587 with TLS, then 465 with SSL. Some providers also support port 2525 (non-standard).
  4. Check your credentials – Log in to your email provider’s webmail to ensure the password works. If you have two-factor auth, generate an app-specific password.
  5. Look at the email log – The plugin logs every email. Check the status – “Sent� or “Failed�. If failed, the log shows the exact reason.
  6. Disable other mail plugins – Temporarily deactivate any other SMTP or email-related plugins to avoid conflicts.
  7. Check PHP mail settings – If you’re not using SMTP and want to fix the default mail(), ensure your VPS has a working MTA (like Postfix or Sendmail). But SMTP is the recommended solution.
  8. Contact your VPS provider – Some providers block outbound SMTP by default to prevent spam. Ask them to unblock it or provide a relay.

Frequently Asked Questions

Why are my WordPress emails not being sent at all?

This usually happens because the PHP mail() function is not configured on the VPS. SMTP bypasses that by using an external server, so installing an SMTP plugin and configuring it solves the issue.

Can I use my Gmail account for SMTP?

Yes, but you’ll need to enable “Less secure app accessâ€� or create an app password if you have two-factor authentication. Google also has a limit of 500 emails per day for free accounts.

What is the difference between port 465 and 587?

Port 465 uses implicit SSL (the connection is encrypted from the start). Port 587 uses STARTTLS (the connection starts plain and upgrades to TLS). Both are secure, but some providers only support one.

Do I need a plugin to send SMTP emails?

Technically, you can add SMTP settings to your wp-config.php file using the PHPMailer class, but it’s easier and safer to use a plugin. Plugins provide a user interface and error logging.

Why are my emails going to spam?

This could be due to your domain’s SPF/DKIM records not being set up properly. Add SPF and DKIM records to your DNS to improve deliverability. Your email provider will give you the exact values.

What if I don’t have an SMTP server?

You can use a transactional email service like SendGrid, Mailgun, or Amazon SES. They offer free tiers and are designed for WordPress. WP Mail SMTP has built-in integrations for these.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →