WP Mail config generator

WordPress’s wp_mail() function does not send email on its own. It hands the message to PHPMailer, which by default calls PHP’s mail(), and that in turn hands the message to whatever local MTA is on the box, which on most shared and cloud hosts is either missing, misconfigured, or blocked outbound on port 25. The fix is always the same shape: intercept phpmailer_init and point PHPMailer at a real SMTP endpoint. What differs is where the interception lives. This tool picks a provider, picks the interception point, and returns the exact config for that combination.

WP Mail SMTP → Settings → Email → General

Open WP Admin → WP Mail SMTP → Settings and enter these values in the General tab. Save, then send a test from WP Mail SMTP → Tools → Email Test.

INI
# nanoPost: SendGrid + WP Mail SMTP
# Review: https://nanopo.st/smtp-email-services/sendgrid/
# Guide:  https://nanopo.st/how-to/wordpress-email-setup-ultimate-guide/

Mailer: SendGrid
API Key: [your SendGrid API key]
Sending Domain: example.com
From Email: [email protected]
From Name: Your Site
Force From Email: On
Force From Name: On
  • Create a Restricted Access API key with Mail Send set to Full Access. WP Mail SMTP's SendGrid mailer has no region setting and sends to api.sendgrid.com.
  • Sending Domain is the domain or subdomain you set up in SendGrid. WP Mail SMTP uses it for the domain check after a test email, not to send.

Snippet defaults come from the same nanoPost dataset the rest of the site’s tools use. Endpoint, port, and TLS mode are locked to whatever the provider actually accepts; auth is set to whichever credential model the provider prefers. Nothing is submitted anywhere. Everything is generated in your browser or on this server and shown back to you.

The five delivery methods

  • WP Mail SMTP (plugin settings): the field-by-field walkthrough for the plugin’s UI. Native mailer where WP Mail SMTP ships one for the provider (SendGrid, Mailgun, Postmark, MailerSend, Gmail, Brevo, and the rest of its supported set). The Amazon SES, Microsoft 365 and Zoho Mail mailers need WP Mail SMTP Pro.
  • FluentSMTP (plugin settings): same walkthrough style for FluentSMTP. FluentSMTP’s native connection for the provider, including the Google and Microsoft sign-ins for Gmail and Microsoft 365.
  • wp-config.php constants: the WPMS_* constants WP Mail SMTP reads before its UI values. Useful when you want the config in source control and out of the database, or when you want to lock the settings so a site owner cannot change them from the admin.
  • mu-plugin: a full standalone must-use plugin at wp-content/mu-plugins/smtp-<provider>.php. Loads on every request, cannot be deactivated from the admin, and sets wp_mail_from + wp_mail_from_name on top of the SMTP transport. The right choice when outbound email must not silently fall back to PHP mail() because someone deactivated a plugin.
  • theme functions.php: a phpmailer_init snippet only. Simplest to paste, but only survives while the theme is active; do not use it in a parent theme you might switch away from.

What the defaults come from

The nanoPost dataset behind this generator carries, per provider:

  • Endpoint. The actual SMTP host. For Amazon SES the host contains a {region} placeholder the tool leaves in place. Swap in the region your SES sending identity lives in before pasting.
  • Ports and TLS. The port + encryption combination the provider accepts. The tool prefers 587 with STARTTLS, then 465 with SMTPS, then falls back to whatever combination the provider publishes.
  • Auth method. The credential model, taken from each provider’s SMTP docs. SendGrid, SparkPost and Resend each take a fixed username (apikey, SMTP_Injection and resend) with an API key as the password. Mailjet takes its API key as the username and its secret key as the password. Postmark’s server API token goes in both fields, and ZeptoMail’s username is emailapikey. Mailgun, Brevo, SMTP2GO, SendLayer and Netcore keep both fields as placeholders, with a note saying where the provider issues them. SES gets its distinct SMTP credentials (not the IAM key/secret). Gmail and Zoho Mail get an app-password placeholder. Microsoft 365 gets login placeholders, with notes on when its SMTP AUTH is off.

Plugin-method availability comes from what each plugin actually supports. The WP Mail SMTP row is only offered when the selected provider has a WP Mail SMTP native mailer; same for FluentSMTP. For any other provider, use a code-level method, or enter its host, port and encryption in the plugin’s own SMTP option. Code-level methods work for every provider with a published SMTP endpoint, which is every provider on file.

What the tool does not do

  • No live SMTP test. The snippet is structurally valid for the provider; whether your credentials work is between you and the provider dashboard.
  • No secrets stored. From-email and from-name are the only inputs, and they are only echoed back into the generated snippet in your browser. Nothing is persisted, logged, or sent anywhere.
  • No opinion on which provider you should pick. That’s what the SMTP cost calculator and each provider’s nanoPost review are for.
  • DNS Auth Checker: once the SMTP is wired, this checks whether SPF, DKIM, and DMARC actually authorise the mail the new snippet is about to send.
  • SPF Record Merger: the mechanical step of adding the new provider’s include: to your existing SPF record. The merger counts the SPF lookup terms in the pasted record and follows its include: and redirect= records in your browser. It does not count MX or PTR resource records queried, so its badge is not a complete RFC 7208 lookup count when an evaluated record uses mx or ptr.
  • SMTP Error Decoder: when the snippet is in place but a specific bounce message appears, this maps common SMTP reply codes to the actual fix.
Corrections
  • 2026-11-26: an earlier version said the SPF merger adds an include without passing the ten-lookup limit. The merger follows nested include: and redirect= records, but it does not count MX or PTR resource records queried. Its badge can therefore understate the RFC 7208 count when an evaluated record uses mx or ptr.
  • 2026-11-25: until this date the generator’s Microsoft 365 note dated the SMTP AUTH default to 2022 and sent readers to the Exchange admin center to enable a mailbox. Microsoft says SMTP AUTH is disabled for organisations created after January 2020, and the per-mailbox setting is in the Microsoft 365 admin center. Its Zoho Mail note said SMTP never accepts the account password; Zoho says you may need an application-specific password if two-factor authentication is on. The Zoho Mail snippets also gave one host without saying that paid organisation accounts use smtppro.zoho.com.
  • 2026-11-25: until this date the generator’s plugin blocks left out rows and used labels that are not on the plugin’s own form. FluentSMTP’s SendGrid and SMTP2GO blocks had no API Region and its Elastic Email block no Email Type; without EU in API Region, SendGrid refuses mail from an account that uses EU data residency. WP Mail SMTP’s SendGrid and Brevo blocks had no Sending Domain, its Gmail, Microsoft 365 and Zoho Mail blocks no Authorization, and its Zoho Mail block no Redirect URI. The Microsoft 365 block listed From Name and the Zoho Mail block From Email, which WP Mail SMTP disables for those mailers.
  • 2026-11-25: until this date the generator gave three providers a password SMTP block although the plugin has its own mailer for them: Gmail and Microsoft 365 in FluentSMTP, and MailerSend in WP Mail SMTP. Its WP Mail SMTP blocks gave Zoho’s Region as com (it is US), showed the Amazon SES, Microsoft 365 and Zoho Mail fields without saying those mailers need WP Mail SMTP Pro, and listed a Return Path setting for mailers whose form does not show one, such as SendGrid, Postmark and Brevo. Its FluentSMTP blocks listed Force From Email and the return-path setting for connections that do not have them, and said FluentSMTP sends a test email when you save. This page said providers without a native mailer get an Other SMTP block; the plugin methods are not offered for them.
  • 2026-11-11: an earlier version said API-key mailers get username apikey, and the code snippets used that username for nine providers whose SMTP logins differ. SendGrid is the provider that takes it; each of the others now gets the login its SMTP docs give.