How to set up SMTP email delivery in WordPress

Table of Contents

How to Setup Free SMTP Email Delivery in WordPress (Fix Emails Going to Spam)

If your WordPress website is failing to deliver contact form notifications, WooCommerce order receipts, or password reset emails—or if those critical messages are landing straight in your customers’ SPAM folders—you are facing one of the most common architecture flaws in WordPress.

By default, WordPress attempts to deliver transactional emails using native PHP execution (wp_mail()). This legacy method is notoriously unreliable, completely unauthenticated, and heavily flagged by modern mail providers like Gmail, Yahoo, and Outlook.

In this comprehensive, step-by-step developer guide, we will examine the technical reasons why native WordPress emails fail, how to route your transactional mail through a free SMTP service (Brevo), and how to configure critical DNS security records (SPF, DKIM, DMARC) so your website emails achieve 100% inbox deliverability—without bloat or recurring monthly costs.

Why Default WordPress Emails Go to Spam (The Technical Problem)

To permanently resolve email delivery failures, you must first understand how WordPress handles outgoing mail under the hood.

When a trigger event occurs on your website (such as an Elementor Form submission, a WooCommerce checkout, or a new user registration), WordPress invokes a core internal function called wp_mail(). If no custom SMTP server is defined, wp_mail() hands the email directly to your web hosting server’s local PHP mail process (mail()).

[ WordPress Event ] ──> wp_mail() ──> Local PHP mail() ──> Shared Server IP ──> [ Recipient Spam Box ]

The 4 Major Failure Points of Native PHP Mail:

  • Shared Hosting IP Reputation: On shared hosting platforms (such as Bluehost, SiteGround, or HostGator), hundreds of websites share a single outgoing IP address. If just one malicious site on that server sends spam, major inbox providers blacklist the entire server IP.
  • Lack of Domain Authentication: Modern mail servers enforce strict domain verification protocols. Native PHP mail() cannot attach cryptographic signatures (DKIM) or authorization policies (SPF), causing receiving servers to flag your domain as an unverified spoofer.
  • Missing Reverse DNS (PTR) Records: Most web hosts do not map reverse DNS records for outgoing web server IPs, leading Gmail and Microsoft to automatically quarantine incoming messages.
  • Server-Level Execution Rate Limits: To conserve server resources, many managed hosts throttle or outright block local PHP execution for outgoing emails.

The Technical Solution: You must decouple email sending from your web host. By routing transactional emails through a dedicated SMTP (Simple Mail Transfer Protocol) provider, you utilize high-reputation IPs and cryptographically signed headers.

Step 1: Selecting the Ideal Free SMTP Provider

While several commercial SMTP relays exist (such as Amazon SES, Mailgun, or SendGrid), Brevo (formerly Sendinblue) offers the most robust free plan for WordPress sites:

  • 300 free emails per day (up to 9,000/month—more than enough for small-to-medium businesses, blogs, and WooCommerce stores).
  • Dedicated API and SMTP Relay infrastructure.
  • Real-time deliverability logs and open/click tracking.
  • Zero credit card required for activation.

Step 2: Creating and Configuring Your Brevo Account

  • Navigate to Brevo.com and register for a free developer/business account.
  • Complete your basic profile verification details.
  • In your main dashboard, navigate to your profile menu (top right) and click Senders & IP / Domains.
  • Select the Domains tab and click Add a Domain.
  • Enter your root domain name (e.g., yourwebsite.com) and save.

Step 3: Configuring DNS Records (SPF, DKIM & DMARC)

This is the most crucial step for 100/100 email deliverability. Authenticating your domain proves to Google and Yahoo that emails originating from your server are legitimate and authorized.

Log into your DNS Manager (Cloudflare, cPanel, Namecheap, GoDaddy, etc.) and add the following three records generated by Brevo:

1. Add the DKIM Record (TXT)

DKIM adds an encrypted signature to every outgoing email header.

  • Type: TXT
  • Name / Host: mail._domainkey (or as generated inside Brevo)
  • Value: (Copy the unique, long cryptographic string provided in Brevo)

2. Add the SPF Record (TXT)

SPF explicitly authorizes Brevo’s mail servers to send messages on behalf of your domain name.

  • Type: TXT
  • Name / Host: @ (or leave empty depending on your DNS host)
  • Value: v=spf1 include:spf.sendinblue.com ~all

3. Add the DMARC Record (TXT)

DMARC defines how receiving inbox providers should handle messages that fail SPF or DKIM checks.

  • Type: TXT
  • Name / Host: _dmarc
  • Value: v=DMARC1; p=none; rua=mailto:dmarc-reports@yourwebsite.com

Once saved, return to Brevo and click Verify / Authenticate Domain. DNS propagation typically takes between 2 to 15 minutes.

💡 Is Your WordPress Architecture Unstable or Bloated?

Resolving email deliverability solves critical transactional communications. However, if your WordPress environment suffers from bloated plugins, unoptimized MySQL tables, or high TTFB (Time to First Byte), fixing SMTP alone won’t optimize your user experience or search rankings.

Discover WP Flow Mastery—a comprehensive 160-page technical manual filled with clean, plugin-free PHP snippets, LiteSpeed/WP Rocket optimization frameworks, and step-by-step security hardening scripts.

➡️ [Unlock the Full WordPress Optimization Guide — $19]

Step 4: Generate Your SMTP API Key / Credentials

After domain verification is complete:

  • In Brevo, go to your profile menu and select SMTP & API.
  • Under the API Keys tab, click Generate a new API Key.
  • Name your key (e.g., WordPress Production SMTP) and click Generate.
  • Copy and safely store the generated key—you will not be able to view it again.

Step 5: Connecting SMTP to WordPress (2 Methods)

You can connect Brevo to your WordPress installation via two distinct methods: using a lightweight, dedicated plugin, or using a clean, zero-plugin PHP snippet.

Method A: Using FluentSMTP (Recommended Plugin Method)

  • Navigate to Plugins → Add New in your WordPress dashboard.
  • Search for FluentSMTP (a completely free, high-performance, ad-free SMTP manager).
  • Install and Activate FluentSMTP.
  • Go to Settings → FluentSMTP.
  • Select Brevo from the list of providers.
  • Input your Brevo API Key, Sender Email (must match your authenticated domain, e.g., info@yourwebsite.com), and Sender Name.
  • Click Save Connection Settings.

Method B: Lightweight Custom PHP Code (Zero-Plugin Method)

If you prefer to keep your plugin footprint minimal, you can hook directly into PHPMailer using your child theme’s functions.php file or a custom code snippet plugin.

Add the following production-ready PHP snippet:

PHP

/**
 * Custom SMTP Configuration via PHPMailer
 * Replaces default wp_mail() execution with authenticated SMTP relay.
 */
add_action( 'phpmailer_init', 'wp_flow_custom_smtp_config' );

function wp_flow_custom_smtp_config( $phpmailer ) {
    $phpmailer->isSMTP();
    $phpmailer->Host       = 'smtp-relay.brevo.com'; // Brevo SMTP Relay Host
    $phpmailer->SMTPAuth   = true;
    $phpmailer->Port       = 587; // TLS Encryption Port
    $phpmailer->Username   = 'your-brevo-account-email@domain.com'; // Brevo Account Username
    $phpmailer->Password   = 'YOUR_BREVO_SMTP_KEY'; // Your Generated SMTP Key
    $phpmailer->SMTPSecure = 'tls';
    
    // Define Default Sender Details
    $phpmailer->From       = 'info@yourwebsite.com';
    $phpmailer->FromName   = 'Your Website Name';
}

Be sure to replace the placeholder credentials with your exact Brevo account details and API key.

Step 6: Testing and Verifying Deliverability

Never assume configuration is complete without executing an active end-to-end test.

  • If using FluentSMTP, open the Tools → Email Test tab.
  • Enter an external personal address (e.g., a standard Gmail inbox).
  • Click Send Test Email.
  • Open the test email in your inbox, click the top-right options menu, and select Show Original.
  • Verify that both SPF and DKIM display a status of PASS.

Summary Checklist for 100/100 Email Deliverability

To ensure your WordPress emails never hit the SPAM folder again, verify this 5-point checklist:

  • Disabled Native PHP mail(): Stopped relying on unauthenticated host processes.
  • Configured Free Brevo Relay: Provisioned 300 authenticated daily emails.
  • Verified DKIM Record: Signed outgoing messages with cryptographic keys.
  • Verified SPF Record: Authorized Brevo servers to send mail for your domain.
  • Validated Headers: Confirmed PASS status for SPF and DKIM inside Gmail.

Master WordPress Performance and Security

Fixing SMTP email deliverability eliminates a major transactional pain point for your business. But what about site loading speed, database bloat, Core Web Vitals, and security hardening?

If you want to build ultra-fast, secure, and resilient WordPress sites without relying on bloated, slow plugins:

Upgrade to WP Flow Mastery Today

WP Flow Mastery is a 160-page developer manual built specifically to take you from a basic site builder to an advanced WordPress optimization specialist.

👉 [Download Your Copy of WP Flow Mastery ($19) — Instant Digital Access]

Written by Nemanja Stosic

WordPress Developer & Website Optimization Specialist

Nemanja helps businesses and freelancers build, optimize, and maintain professional WordPress websites focused on performance, SEO, security, and usability.