Out of the box, WordPress sends email with PHP's mail() function through the web host's own mail server. On most hosts that is restricted, rate-limited or blocked outright, and the mail that does leave is not authenticated for the client's domain, so receiving servers treat it with suspicion. The fix is the same on every site: send through a proper email provider with an SMTP plugin, and authenticate the domain in DNS.
This guide covers the four providers agencies use most for client sites. Provider dashboards change their layout often, so treat menu names as signposts; the settings and records themselves are stable.
The pieces
Every setup has three parts:
- An SMTP plugin in WordPress that replaces the default mailer. WP Mail SMTP, FluentSMTP and Post SMTP are the common choices. All three can connect over plain SMTP, and most can also use a provider's HTTP API, which is usually faster and gives clearer errors.
- A provider account with a verified sending domain, and a credential the plugin uses: an API key, an SMTP password or an OAuth connection.
- DNS records on the client's domain that tell receiving servers the provider is allowed to send for it: SPF, DKIM and a DMARC policy. Our post on SPF, DKIM and DMARC for agency-managed sites explains each record in depth.
Whichever provider you choose, set the plugin's From Email to an address on the client's domain, such as website@clientdomain.com, and turn on Force From Email if the plugin offers it, so form plugins cannot override it with the visitor's address. Visitor addresses belong in Reply-To.
Choosing a provider
| Provider | Best for | Watch out for |
|---|---|---|
| Postmark | Transactional mail that must arrive fast; agencies that want clear logs | Transactional only: marketing mail goes on a separate stream |
| SendGrid | Teams already using Twilio; high volume | Domain authentication uses several CNAME records; check the plan you are on |
| Brevo | Clients who also send newsletters from Brevo | SMTP uses an SMTP key, not the API key |
| Gmail / Google Workspace | Very small sites where the client already has Workspace | Daily sending limits, app passwords, and mail sent "as" the account |
For an agency running many client sites, a transactional provider (Postmark, SendGrid or Brevo) with one account per client is the cleanest arrangement: the client owns the account, credentials are separate, and one client's problem never affects another's.
Postmark
Create a server for the site in Postmark. Each server has its own Server API Token. Form notifications belong on the default transactional message stream.
Verify the domain under Sender Signatures › Domains. Postmark shows two records:
- a DKIM record, a
TXTrecord at a selector such as20241001pm._domainkey, and - a Return-Path
CNAME, typicallypm-bounces.clientdomain.compointing topm.mtasv.net.
The custom Return-Path aligns bounces with the client's domain, which is what lets SPF pass for DMARC. Postmark does not need an SPF include on the main domain when the Return-Path is set up.
In the SMTP plugin: choose the Postmark mailer and paste the Server API Token, or use SMTP with:
Host: smtp.postmarkapp.com
Port: 587 (TLS) alternatives: 2525, 25
Username: <Server API Token>
Password: <Server API Token>
Postmark's Activity view shows every message with its status and the receiving server's response, which makes it the easiest of the four to diagnose.
SendGrid
Authenticate the domain under Settings › Sender Authentication › Domain Authentication. SendGrid generates three CNAME records: two DKIM records (s1._domainkey and s2._domainkey) and one for the return path (em1234.clientdomain.com). With automated security on, SendGrid manages the SPF and DKIM values behind those CNAMEs, so you do not need to edit the SPF record yourself.
Create an API key under Settings › API Keys with Restricted Access and only Mail Send enabled. The key is shown once.
In the SMTP plugin: choose the SendGrid mailer and paste the key, or use SMTP with:
Host: smtp.sendgrid.net
Port: 587 (TLS)
Username: apikey
Password: <the API key>
The username really is the word apikey. A 535 authentication error almost always means the key was deleted, rotated or lacks Mail Send permission.
Brevo
Add and authenticate the domain under Senders, Domains & Dedicated IPs › Domains. Brevo shows the records to add: a brevo-code TXT record for ownership, DKIM records, and a recommended DMARC record if the domain has none.
Get the SMTP credentials under SMTP & API. Brevo's SMTP login is an address that Brevo issues, and the password is an SMTP key that you generate on that page. The API key on the neighbouring tab is a different credential and does not work for SMTP.
In the SMTP plugin: choose the Brevo mailer and paste an API key, or use SMTP with:
Host: smtp-relay.brevo.com
Port: 587 (TLS)
Username: <SMTP login shown by Brevo>
Password: <SMTP key>
If the client also sends newsletters from the same Brevo account, a campaign that generates complaints can affect the account's sending reputation. For important sites, keep transactional mail on its own account or sending domain.
Gmail and Google Workspace
Sending through Google works, but it is designed for people, not websites. Use it only for small sites where the client already pays for Workspace and volume is low.
Prefer OAuth. WP Mail SMTP and FluentSMTP can connect to Google with OAuth, using the Google / Gmail mailer. There is no password to expire, and the plugin sends through the Gmail API.
If you must use SMTP, the Google account needs 2-Step Verification and an app password; Google no longer accepts the account's normal password for SMTP. Then:
Host: smtp.gmail.com
Port: 587 (TLS) or 465 (SSL)
Username: the full Google address
Password: <16-character app password>
Things to know:
- Mail is sent as the Google account. The From address must be that account or an alias configured in Gmail; anything else is rewritten.
- Google applies daily sending limits per account, far lower than a transactional provider's. A form that suddenly receives spam can hit them.
- Workspace domains still need SPF (
include:_spf.google.com), DKIM (generated in the Workspace admin console under Apps › Google Workspace › Gmail › Authenticate email) and DMARC. - App passwords stop working when the user changes their Google password or an admin turns them off. That is one of the commonest silent failures on small client sites.
After setup: test it properly
Once the plugin is connected:
- Use the SMTP plugin's own test email and confirm it reports success.
- Submit each form on the site and confirm the notification arrives in an outside mailbox, not only the client's.
- Open the received message's headers (in Gmail, Show original) and confirm SPF, DKIM and DMARC all pass, aligned with the client's domain.
- Find the message in the provider's activity log, so you know where to look next time.
The contact form testing checklist has the full list.
Keep it working
SMTP setups fail later, not on day one: a key is rotated, a domain's DNS moves, a Google password changes, a provider suspends an account for a billing problem. FormVigilant tests each form on a schedule and reads the outcome from the SMTP plugin and the provider, so a rejected message shows up as L3: mail server rejected the message, often with the provider's own error such as 535 authentication failed, and a missing DKIM record after a DNS move shows up in the L4 header results. The SMTP and DNS troubleshooting page lists the checks for each reason code.