Just installed the new SMTP plugin from WordPress.org and wondering what to type into it? With a mail server to send through, setting up the WordPress SMTP plugin takes minutes.
SMTP, the new community-maintained plugin on WordPress.org, routes your site’s email through a real mail server. But it doesn’t come with a server. You still need an email service and its login details.
In this guide, I’ll show you how to connect the SMTP plugin to an SMTP server.
What Is the WordPress SMTP Plugin?
The SMTP plugin is a free plugin that sends WordPress emails through an SMTP server you choose. The WordPress Plugins Team started it, and the community maintains it on GitHub. It isn’t part of WordPress core.
SMTP (Simple Mail Transfer Protocol) is the standard way email servers pass messages to each other. Without it, WordPress uses your web host’s PHP mail function. That often lands emails in spam or causes them to be lost.
Here’s what the plugin includes as of the time of writing this post (version 1.2.0):
- One provider: “Generic SMTP”, which works with any service that offers SMTP.
- A basic email log: The recipient, subject, status, and error for each email. It doesn’t store message bodies or attachments, and it deletes entries after 30 days.
- A test email tool: With a connection log and a hint when something fails.
- Slack alerts when an email fails, plus wp-config.php constants and WP-CLI commands.
Prerequisites
Before you start, make sure you have these ready:
- WordPress 6.3 or later and PHP 7.4 or later
I’ll use SendLayer for this tutorial. But the setup works similarly regardless of the SMTP server you use.
One of the best SMTP and email API providers. One standout feature I like about SendLayer is the AI integration and domain protection. SendLayer sends your email through a subdomain. This protects your actual domain in case of any issues with the sending IP address.
Don’t have a SendLayer account yet? Setup only takes a few minutes.
After setting up your SendLayer account, you’ll need to authorize your sending domain. This step verifies domain ownership and improves email deliverability.
How to Set Up the WordPress SMTP Plugin With SendLayer
To set up the WordPress SMTP plugin with SendLayer, copy your SMTP credentials from SendLayer. Then enter them under Tools » SMTP, with host smtp.sendlayer.net, port 587, and TLS (STARTTLS) encryption.
Let’s walk through each step.
Step 1: Copy Your SendLayer SMTP Credentials
First, log in to your SendLayer dashboard and click Settings in the navigation menu. Then open the SMTP Credentials tab.
Keep this tab open. You’ll paste these values into WordPress in Step 3:
- Username: Your SMTP login name.
- Password: Your SMTP password.
- Host:
smtp.sendlayer.net - Port:
587
Pro Tip: Need a fresh password or a second login? Our guide to managing SMTP credentials shows how to add or reset them.
Step 2: Install and Activate the SMTP Plugin
Next, check that no other SMTP plugin is active on your site. Two mailer plugins fight over the same emails, so deactivate the old one first.
If you skip this, the plugin shows a warning on its Settings and Test tabs.
Now go to Plugins » Add New Plugin in your WordPress dashboard. Search for “SMTP” and find the plugin simply named SMTP. Its WordPress.org listing helps you confirm it’s the right one.
Click Install Now, then Activate.
The plugin does nothing until you enter a host. So activating it won’t change how your site sends email yet.
Step 3: Enter the SendLayer SMTP Settings
Now go to Tools » SMTP. You’ll land on the Settings tab, with Generic SMTP already selected as the Provider.
Fill in the fields like this:
Host: smtp.sendlayer.net
Port: 587
Encryption: TLS (STARTTLS)
Authentication: checked
Username: your SendLayer SMTP username
Password: your SendLayer SMTP password
From email: an address on your authorized domain
From name: your site or business name
Force from: checked
A port is the numbered “door” a mail server listens on. STARTTLS means the connection starts plain, then switches to encryption before your password is sent. SendLayer uses port 587 with STARTTLS, so stick with those 2 values.
For the From email, make sure it includes your authorized sending domain. So if your domain is example.com, the From email includes @sl.example.com.
The Example Email in your dashboard already uses the right format. You can copy it.
The subdomain keeps your sending reputation separate from your main domain. SendLayer explains why it sends from a subdomain.
I recommend checking Force from. Without it, the plugin only replaces WordPress’s default wordpress@ address.
Form and store plugins that set their own From address would keep it. SendLayer may reject an address it hasn’t authorized.
Click Save Changes when you’re done.
Pro Tip: The plugin never shows your saved password again. When you come back later, the field says “A password is saved. Leave empty to keep it.”
Step 4: Send a Test Email
Now click the Test tab at the top of the Tools » SMTP screen.
Type your own address in the Send to field and click Send test email.
If it works, you’ll see a green notice that says “Test email sent to” your address. Then look for the subject “SMTP test email from” plus your site name.
Below the notice, the Connection log shows each step of the conversation with SendLayer. The plugin hides your password here, so it’s safe to share.
Step 5: Check Delivery in SendLayer
The plugin’s Email log tab only tells you whether WordPress handed the email off. It can’t tell you whether the email reached the inbox. SendLayer’s own log fills that gap.
In your SendLayer dashboard, click Logs in the sidebar menu.
You’ll see a 30-day graph and a table of every email your site sent.
Each email shows its events. Here’s an overview of the events SendLayer tracks:
- Accepted: SendLayer or the receiving server accepted the email.
- Sent: SendLayer’s SMTP server sent it out.
- Rejected: The receiving server refused it.
- Opened and Clicked: The recipient opened it or clicked a link (with tracking turned on).
- Complained: The recipient marked it as spam.
SendLayer also adds hard bounces and unsubscribes to your suppression list automatically. That protects your sending reputation.
Optional: Store Your Credentials in wp-config.php
For production sites, the plugin recommends putting your SMTP settings in wp-config.php. That keeps your credentials out of the database.
wp-config.php is the main settings file in your site’s root folder. You can edit it through your host’s file manager or an FTP client.
Note: If you need help finding your site’s configuration file, see WPBeginner’s tutorial on accessing and editing wp-config.php.
After opening the file, find the line that says /* That's all, stop editing! Happy publishing. */. Then paste this code just above it:
define( 'SMTP_HOST', 'smtp.sendlayer.net' );
define( 'SMTP_PORT', 587 );
define( 'SMTP_ENCRYPTION', 'tls' );
define( 'SMTP_USER', 'your-sendlayer-smtp-username' );
define( 'SMTP_PASSWORD', 'your-sendlayer-smtp-password' );
define( 'SMTP_FROM_EMAIL', '[email protected]' );
Replace the placeholder values with the ones from your SendLayer SMTP Credentials tab. Then save the file.
Back in Tools » SMTP, each of those fields is now grayed out. Below each one, you’ll see a note like “Defined by the SMTP_HOST constant.”
Warning: Never commit wp-config.php with real credentials to a public Git repository. Anyone who sees the password can send email as your domain.
There’s no constant for From name, Force from, or Authentication. You still set those on the Settings tab.
Optional: Test From the Command Line With WP-CLI
WP-CLI is WordPress’s command-line tool. The SMTP plugin adds 3 commands: wp smtp settings set, wp smtp status, and wp smtp test.
To save the SendLayer settings from your terminal, run these commands from your WordPress folder:
wp smtp settings set host=smtp.sendlayer.net port=587 encryption=tls auth=yes username=your-sendlayer-smtp-username
wp smtp settings set password=-
wp smtp settings set [email protected] from_name="My Site" force_from=yes
The plugin won’t take a password as a normal argument. It would end up in your shell history. With password=-, you get a hidden prompt where you can paste it.
To check your setup and send a test, run:
wp smtp status
wp smtp test [email protected] --connection-log
wp smtp status lists each setting, its value, and its source (constant, database, or default). Passwords only show as set or not set.
wp smtp test prints “Test email sent to” your address when it works. The --connection-log flag adds the connection log, without your password.
What the SMTP Plugin Doesn’t Do (Yet)
The SMTP plugin is new and deliberately small. Here’s what it can’t do:
- No API sending: It only sends over SMTP.
- No resend: The log doesn’t store email content, so you can’t resend a failed email.
- No backup connection: If your mail server is down, there’s nothing to fall back on.
- Slack-only alerts: Developers can add other alert channels with code.
If you need any of these, I recommend Easy WP SMTP with its SendLayer mailer instead. It connects through SendLayer’s API. Your host can’t block that the way it blocks SMTP ports.
The paid version adds a full email log with resends, a backup connection, and more alert channels. Here’s a link to the SendLayer mailer setup guide that walks you through it.
Troubleshooting the SMTP Plugin With SendLayer
Most problems come from a blocked port, a wrong password, or the From address.
“The Server Could Not Be Reached”
This usually means your host blocks outgoing connections on port 587. Double-check that Host is smtp.sendlayer.net and Port is 587.
If both are right, ask your hosting company to open port 587. If they won’t, switch to Easy WP SMTP’s SendLayer mailer. It uses the API, not an SMTP port.
“The Server Rejected the Login”
Your username or password doesn’t match. Copy both again from the SMTP Credentials tab in SendLayer, with no extra spaces.
Use your SMTP password here, not your SendLayer account password or an API key.
“The Server Rejected the Sender”
SendLayer only accepts From addresses on your authorized domain. Set From email to match your Example Email format. Then check Force from so other plugins can’t change it.
The Settings Fields Are Grayed Out
A constant in wp-config.php sets each grayed-out field. The note under it names the constant, so edit that line instead.
Emails Still Go Through the Default WordPress Mailer
With Authentication checked, the plugin only takes over once a username and password are saved. Until then, it keeps the default mailer.
The Test tab will say “SMTP is not configured yet, so the test email will be sent with the default WordPress mailer.” Re-enter your password, click Save Changes, and test again.
Frequently Asked Questions
Here are quick answers to common questions.
Is the WordPress SMTP plugin free?
Yes. The SMTP plugin is free on WordPress.org, with no paid version or upsells. You’ll still need an email service like SendLayer, which starts with a free trial.
Does the SMTP plugin work with SendLayer’s API?
Not yet. Currently, the plugin only sends over SMTP. For SendLayer’s API, use Easy WP SMTP or WP Mail SMTP with the SendLayer mailer.
Which port should I use for SendLayer?
Use port 587 with TLS (STARTTLS) encryption. That’s the port SendLayer lists on its SMTP Credentials tab.
Is it safe to store SMTP passwords in WordPress?
The plugin stores passwords apart from its other settings and never shows them on the page. In version 1.2.0, they still sit in your database. For the most protection, define SMTP_PASSWORD in wp-config.php so it never touches the database.
Can I see if my email was delivered?
Partly. The plugin’s log shows whether each email was sent or failed. For delivery details like accepted, rejected, and opened, check the Logs page in your SendLayer dashboard.
That’s it! Now you know how to use SendLayer with the WordPress SMTP plugin.
Next, want to compare another way to connect WordPress to SendLayer? Our guide to setting up WordPress email uses the SendLayer API mailer instead of SMTP.