Sending from WordPress over SMTP
Make a WordPress site hosted anywhere send its email through Reggio Digital over SMTP, with a small must-use plugin or an SMTP plugin you already run.
WordPress sends its email, from password resets to shop orders and contact forms, through one function, and out of the box that function hands mail to whatever the web server has. On most hosts that mail arrives late, lands in spam, or never arrives. Pointing WordPress at us over SMTP sends it from the business's own verified domain instead.
If we host the site, stop here. We connect sites on our hosting for you, with nothing to install. Open a ticket and say which site.
Before you start
- The from address has to be on a sending domain the account has verified. If the business has not added one yet, they do it under Sending domains. See the DNS a sending domain needs.
- Open that domain and choose to connect an app. The page shows the host, username and password you need below.
With a small must-use plugin
This is the version with nothing to update and no settings screen for someone to change by accident. Put the credentials in wp-config.php, above the line that says to stop editing:
define('REGGIO_SMTP_HOST', 'YOUR_SMTP_HOST');
define('REGGIO_SMTP_USERNAME', 'YOUR_SMTP_USERNAME');
define('REGGIO_SMTP_PASSWORD', 'YOUR_SMTP_PASSWORD');
define('REGGIO_SMTP_FROM', 'hello@yourdomain.com');
Save the second block as its own file in wp-content/mu-plugins/, creating the folder if it is not there. WordPress loads everything in that folder on every request and it cannot be switched off from the admin screens.
Port 587 with SMTPSecure set to tls connects in plain text and upgrades to an encrypted connection before anything is sent, which is what our service expects. ssl expects encryption from the first byte and will time out on this port.
The wp_mail_from line matters. WordPress sends as wordpress@ the site's own hostname unless told otherwise, and if the site's address is not on the verified domain every message is refused.
With an SMTP plugin you already run
If the site already has an SMTP plugin, such as WP Mail SMTP, FluentSMTP or Post SMTP, use it instead of the code above. Do not run both. In its settings choose the generic or "other SMTP" option, not a named provider, and enter:
| Setting | What to enter |
|---|---|
| SMTP host | Copy it from the domain's page. |
| Port | 587 |
| Encryption | TLS (sometimes shown as STARTTLS) |
| Authentication | On |
| Username and password | Copy them from the domain's page. |
| From email | An address on the verified domain, such as hello@yourdomain.com. Tick "force from email" if the plugin offers it, so other plugins cannot send as a different address. |
Most of these plugins can keep the password in wp-config.php rather than in the database. Use that where it is offered.
Checking it works
Send the plugin's test email, or reset a password, to one of the test addresses. The message appears on the account's Sent page within a minute. If nothing shows up there, WordPress never reached us: check the host and port, and look in the site's error log for the SMTP error.
Some contact form and shop plugins set their own from address per form or per email. Check each one is on the verified domain, or those messages alone will be refused.