WordPress SMTP settings: send your site's email through a real mail server

View as Markdown

Password resets and form messages go missing because WordPress hands email to the web server unauthenticated. Which SMTP settings you need, the values for common providers, and how to read the server's reply when a send fails.

A visitor fills in your contact form and you never hear about it. A customer asks for a password reset and nothing arrives. WordPress says the email was sent, and as far as WordPress can tell, it was. The problem is what happens next, and the fix is a handful of WordPress SMTP settings: a server, a port, an encryption type, a username and a password.

This guide covers why the email goes missing, what to collect from your mail provider, the settings for the common ones, and how to read the error when a send fails.

Why WordPress email goes missing

Out of the box, WordPress sends every email through PHP’s mail() function. That function hands the message to whatever mail program the web server has, and that program delivers it directly, with no login and no mail account behind it.

Receiving mail servers have become strict about that kind of message. They check three things:

A message from mail() on a web server usually fails all of them. The web server is not in your domain’s SPF record, it signs nothing, and if your domain publishes a DMARC policy, that policy tells the receiver to quarantine or reject the message. On shared hosting there is a second problem: you share an IP address with hundreds of other sites, and its sending reputation is whatever the worst of them has made it.

The result is mail that lands in spam or disappears with no bounce. Nothing in WordPress is broken, so nothing in WordPress reports an error.

SMTP fixes this by changing who sends the message. Instead of the web server delivering it, WordPress logs in to a real mail server with a username and password, and that server, which is set up to pass SPF and sign with DKIM for your domain, sends it.

What you need from your provider before you start

Whatever you use to configure it, the list is the same. Get these from your mail provider’s SMTP documentation or dashboard:

Do the domain verification first. Correct SMTP settings with an unverified From address still fail.

SMTP settings for common providers

These are the host, port and encryption values for the providers people ask about most. Your username and password come from the provider’s dashboard.

ProviderHostPortEncryption
Amazon SESemail-smtp.us-east-1.amazonaws.com587TLS
Brevosmtp-relay.brevo.com587TLS
Mailgun (US)smtp.mailgun.org587TLS
Mailgun (EU)smtp.eu.mailgun.org587TLS
SendGridsmtp.sendgrid.net587TLS
Postmarksmtp.postmarkapp.com587TLS
Zoho Mailsmtp.zoho.com465SSL
Gmail / Google Workspacesmtp.gmail.com587TLS

For Amazon SES the region is part of the host name. The row above is US East (N. Virginia); an account in Europe (Ireland) uses email-smtp.eu-west-1.amazonaws.com, and so on. Use the region your SES identities were verified in.

Providers do change their endpoints occasionally, so treat the provider’s own documentation as the final word.

Setting it up with Adminkeep

Adminkeep is a free plugin made of small features that each have one switch, and SMTP is one of them. If you don’t have it yet, installation takes a minute.

  1. Open the Adminkeep settings and switch on SMTP in the Email group. The configuration docs cover how the switches work.
  2. Go to Settings → SMTP. The screen exists only while the feature is switched on.
  3. Pick your provider from the Provider dropdown. That fills in the server, port and encryption. The preset is not saved as a setting; it only fills those three fields, and you can type the details yourself with “Other”.
  4. Enter the username and password, the From address and the From name.
  5. Save.

Switching the feature on changes nothing by itself. Until you name a server, WordPress keeps sending email exactly as it did before, and the screen tells you so.

Once a password is saved, the screen never shows it again. The field becomes a disabled row of dots with a Remove password button beside it. Saving the form leaves the password alone; to change it, press Remove password and type the new one.

If another plugin that configures email is active at the same time, the screen points it out. Whichever runs last decides how mail is sent, so use one or the other.

Keeping the credentials in wp-config.php

Every setting can be defined as a constant in wp-config.php instead of being typed into the form:

define( 'ADMINKEEP_SMTP_HOST', 'smtp.example.com' );
define( 'ADMINKEEP_SMTP_PORT', 587 );
define( 'ADMINKEEP_SMTP_ENCRYPTION', 'tls' );
define( 'ADMINKEEP_SMTP_USER', 'XXXX' );
define( 'ADMINKEEP_SMTP_PASS', 'XXXX' );
define( 'ADMINKEEP_SMTP_FROM', '[email protected]' );
define( 'ADMINKEEP_SMTP_FROM_NAME', 'Example Site' );

What each one holds:

Put them above the line that reads /* That's all, stop editing! */.

A constant wins over the saved value, field by field, so you can define only the password and keep everything else in the form. A value set in wp-config.php is not saved to the database, and the settings form does not display it: the field is disabled and a note under it names the constant that holds it. This is the stronger setup. The credentials never enter the database, so they are in no database backup and no export.

Send a test email and read the server’s reply

Beside the settings is a panel called Send a test email. It uses the saved settings, so save first if you changed anything. Enter an address, send, and one of two things happens.

If the server accepts the message, the panel says so and tells you to check the inbox and its spam folder. Accepted is not the same as delivered to the inbox, which is why the From domain’s SPF and DKIM records still matter.

If it fails, the panel shows the error and opens a section called What the server said: the actual SMTP conversation, with your username and password scrubbed out. Most failures are one of three:

From address, From name, and the two “every email” boxes

By default WordPress sends as wordpress@yourdomain with the name “WordPress”. The From address and From name you save replace those defaults.

They don’t replace a sender that a plugin has chosen for itself. WooCommerce is the usual case: it has its own “from” settings for order emails, and those are respected. Most of the time that is what you want.

It stops being what you want when the plugin’s address is on a domain your provider has not verified, because the server will reject those emails while everything else goes through. That is what the two boxes are for:

Tick the first and every email leaves with your verified address, WooCommerce’s included. The plugin applies its sender late in the process, so a plugin that sets its own at send time cannot undo it.

Gmail, Google Workspace and Microsoft 365

Gmail and Google Workspace work, with one condition: Google needs an app password here, not your normal password. Create one in your Google account under Security, with 2-step verification on, and use it as the SMTP password.

Microsoft 365 and Outlook.com are not supported. Microsoft now requires signing in through Microsoft (OAuth) for SMTP, and this feature does not do OAuth. There is no preset for it because a preset that cannot work is worse than none. If your mail has to go through a Microsoft account, a dedicated SMTP plugin that handles the Microsoft sign-in is the better choice.

What it does not do

This is generic SMTP and nothing more, on purpose:

That last one is deliberate. A fallback sounds safe, but it sends the message down the same unauthenticated route that was losing your email in the first place, and it hides the fact that your SMTP setup is broken. You would find out weeks later, from a customer. A send that fails loudly, with the reason on the screen, gets fixed the same day.

Switching the feature off returns email to the server’s default. Your settings are kept until you uninstall the plugin.

Frequently asked questions

Where is my SMTP password kept?

Encrypted in your site’s database, which protects it in database backups. The stronger option is to define ADMINKEEP_SMTP_PASS, and the other ADMINKEEP_SMTP_* constants if you like, in wp-config.php: values set there are not saved to the database, and the settings form does not display them.

The screen says my saved password can no longer be read. What happened?

The stored password is encrypted using your site’s security keys, the ones in wp-config.php. If those keys change, the saved password cannot be opened any more. Open Settings → SMTP and enter it again. A password held in a constant is not affected.

The test email was accepted but never arrived. Now what?

Check the spam folder first. If it is there, the SMTP settings are fine and the problem is authentication for your domain: confirm in your provider’s dashboard that the domain is verified and that the SPF and DKIM records it gave you are in your DNS.

Does fixing email help with spam signups?

No, that is a separate problem. Reliable email only means the notifications about those signups now reach you. See how to stop spam user registrations for that.

Install it, lock it, forget it.

A free WordPress plugin — GPL, instantly reversible, and updates come to you.

Type to search the whole site.