WP AI Agent
Features Pricing Blog Contact Download Plugin Manage Subscription Get Free Key →

How to Set Up WordPress Email Notifications: Complete Guide

· · 8 min read

Setting up WordPress email notifications is one of the most important configuration tasks for any WordPress site owner, ensuring you and your users receive timely alerts about comments, orders, password resets, form submissions, and more. Without properly configured email notifications, critical messages can land in spam folders or never be delivered at all. This comprehensive guide walks you through every method — from default WordPress settings to advanced SMTP configuration — so your site's email system works reliably every time.

Understanding How WordPress Sends Emails

Before diving into configuration, it helps to understand the mechanics behind WordPress email delivery. By default, WordPress uses the PHP mail() function through the built-in wp_mail() wrapper to send all outgoing messages. While this works in many shared hosting environments, it has significant limitations.

The Default WordPress Email System

WordPress triggers email notifications automatically for a range of events, including:

  • New user registrations
  • Password reset requests
  • New comment notifications
  • Comment moderation alerts
  • Plugin and theme update notices
  • Order confirmations (WooCommerce)

These emails are sent from a default address like [email protected], which many mail servers reject as spam because it lacks proper authentication records.

Why Default Email Often Fails

The PHP mail() function sends email directly from your server without authentication. Modern spam filters require SPF, DKIM, and DMARC records to trust incoming mail. When these are absent or misconfigured, your notifications silently disappear. This is why setting up a dedicated SMTP service is strongly recommended for any production WordPress site.

Configuring WordPress Default Email Notifications

Before adding SMTP or plugins, you should review and customise which built-in notifications WordPress sends. Many of these can be controlled without any additional tools.

Managing Comment Notification Settings

  1. Log in to your WordPress admin dashboard.
  2. Navigate to Settings > Discussion.
  3. Under Email me whenever, check or uncheck Anyone posts a comment and A comment is held for moderation.
  4. Under Before a comment appears, configure moderation rules that affect when emails are triggered.
  5. Click Save Changes to apply your preferences.

Controlling New User Registration Emails

  1. Go to Settings > General in your dashboard.
  2. Locate the Membership section.
  3. Check or uncheck Anyone can register based on your needs.
  4. The New User Default Role setting determines registration flow and associated emails.
  5. Save your changes.

WordPress automatically sends both an admin notification and a welcome email to the new user when registration is enabled. You can disable the admin copy by adding a small snippet to your theme's functions.php file:

// Disable new user notification email to admin
function disable_new_user_admin_notification( $wp_new_user_notification_email_admin, $user, $blogname ) {
    $wp_new_user_notification_email_admin['to'] = '';
    return $wp_new_user_notification_email_admin;
}
add_filter( 'wp_new_user_notification_email_admin', 'disable_new_user_admin_notification', 10, 3 );

Setting Up SMTP for Reliable Email Delivery

Configuring SMTP (Simple Mail Transfer Protocol) is the single most effective step you can take to ensure WordPress email notifications are delivered reliably. SMTP routes your email through an authenticated mail server, dramatically improving deliverability.

Choosing an SMTP Provider

Popular SMTP providers compatible with WordPress include:

  • Gmail / Google Workspace — Free for low volume, excellent deliverability
  • SendGrid — Generous free tier, developer-friendly API
  • Mailgun — Reliable transactional email service
  • Amazon SES — Very low cost at scale
  • Brevo (formerly Sendinblue) — Free tier with 300 emails/day

Installing and Configuring WP Mail SMTP

WP Mail SMTP is the most popular plugin for connecting WordPress to an external SMTP provider. Here is how to set it up:

  1. In your dashboard, go to Plugins > Add New.
  2. Search for WP Mail SMTP and click Install Now, then Activate.
  3. Navigate to WP Mail SMTP > Settings.
  4. Under From Email, enter the email address you want notifications sent from.
  5. Under From Name, enter your site name or brand.
  6. In the Mailer section, select your SMTP provider (e.g., SendGrid, Mailgun, or Other SMTP).
  7. Enter the SMTP host, port (usually 587 for TLS or 465 for SSL), username, and password provided by your mail service.
  8. Enable SSL/TLS encryption as required by your provider.
  9. Click Save Settings.
  10. Use the Email Test tab to send a test message and confirm delivery.

Adding SMTP Credentials to wp-config.php

For better security, store SMTP credentials in your wp-config.php file rather than the database. Add these lines before the /* That's all, stop editing! */ comment:

// SMTP Configuration Constants
define( 'WPMS_ON', true );
define( 'WPMS_SMTP_HOST', 'smtp.sendgrid.net' );
define( 'WPMS_SMTP_PORT', 587 );
define( 'WPMS_SSL', 'tls' );
define( 'WPMS_SMTP_AUTH', true );
define( 'WPMS_SMTP_USER', 'apikey' );
define( 'WPMS_SMTP_PASS', 'your_sendgrid_api_key_here' );
define( 'WPMS_SET_RETURN_PATH', true );

This approach keeps sensitive credentials out of the WordPress database and prevents them from being accidentally exported or exposed through database backups.

Setting Up Custom and Plugin-Based Email Notifications

Beyond core notifications, you may want to trigger custom alerts based on specific user actions or site events. Several plugins make this straightforward without requiring custom development.

Using WooCommerce Email Notifications

If you run an online store, WooCommerce includes a robust email notification system. To configure it:

  1. Go to WooCommerce > Settings > Emails.
  2. You will see a list of all transactional emails: New Order, Cancelled Order, Processing Order, Completed Order, Refunded Order, Customer Invoice, Password Reset, and more.
  3. Click on any email type to configure its recipient address, subject line, heading, and additional content.
  4. Toggle each email type on or off using the Enable this email notification checkbox.
  5. Scroll down to the Email Template section to customise colours and the header image to match your brand.
  6. Click Save Changes after adjusting each notification type.

Contact Form Email Notifications

If you use a contact form plugin such as WPForms, Contact Form 7, or Gravity Forms, each has its own notification system:

  • WPForms: Edit any form, go to Settings > Notifications, and configure recipient email, subject, and message template using smart tags like {admin_email} and {field_id="1"}.
  • Contact Form 7: Edit a form and click the Mail tab to set the To, From, Subject, and body fields.
  • Gravity Forms: Go to Form Settings > Notifications to add multiple notification rules with conditional logic.

Sending Custom Programmatic Notifications

For developers who need full control, WordPress provides the wp_mail() function. You can hook into any WordPress action to trigger a custom email:

// Send a custom notification when a post is published
function notify_admin_on_publish( $new_status, $old_status, $post ) {
    if ( 'publish' === $new_status && 'publish' !== $old_status && 'post' === $post->post_type ) {
        $to      = get_option( 'admin_email' );
        $subject = 'New Post Published: ' . get_the_title( $post->ID );
        $message = 'A new post has been published on your site.' . "\n\n";
        $message .= 'View it here: ' . get_permalink( $post->ID );
        $headers = array( 'Content-Type: text/html; charset=UTF-8' );
        wp_mail( $to, $subject, $message, $headers );
    }
}
add_action( 'transition_post_status', 'notify_admin_on_publish', 10, 3 );

Testing and Troubleshooting WordPress Email Notifications

After configuration, testing your setup thoroughly is essential. Even a correctly configured SMTP server can have edge cases that prevent delivery.

Using the WP Mail SMTP Email Test Tool

  1. Go to WP Mail SMTP > Tools > Email Test.
  2. Enter a recipient email address you can access immediately.
  3. Click Send Email.
  4. Check the inbox, spam, and junk folders of the recipient address.
  5. Review the debug output on the results page for any SMTP errors.

Testing with WP-CLI

If you have command-line access to your server, WP-CLI provides a fast way to test email delivery:

wp eval 'wp_mail("[email protected]", "Test Subject", "This is a test email from WordPress WP-CLI.");'

Common Email Notification Problems and Fixes

  • Emails going to spam: Set up SPF and DKIM DNS records for your sending domain. Most SMTP providers give you exact DNS entries to add.
  • "From" address mismatch: Ensure the From Email in WP Mail SMTP matches the authenticated sender domain in your SMTP provider account.
  • SMTP authentication errors: Double-check your username and password. For Gmail, use an App Password if two-factor authentication is enabled.
  • Port blocked by host: Try port 587 (STARTTLS) instead of port 465 (SSL), or contact your hosting provider to confirm which outbound ports are open.
  • Emails not sending at all: Temporarily switch to a different mailer in WP Mail SMTP and run the test again to isolate whether the issue is plugin configuration or server-level.

Advanced Email Notification Strategies

Once your basic setup is working, consider these advanced techniques to make your WordPress email notifications more effective and professional.

HTML Email Templates

Plain-text emails are functional but miss branding opportunities. Plugins like Email Customizer for WooCommerce or FluentCRM let you design branded HTML templates with drag-and-drop editors. For custom wp_mail() calls, always pass Content-Type: text/html; charset=UTF-8 in the headers array to render HTML properly.

Logging Email Activity

Enable email logging to keep a record of every notification sent from your site. The free WP Mail Log plugin or the logging feature built into WP Mail SMTP Pro records the recipient, subject, timestamp, and delivery status for every email. This is invaluable when debugging missed notifications or investigating deliverability issues.

Conditional Notifications with Automations

Tools like AutomateWoo, FluentCRM, or Uncanny Automator allow you to build conditional email workflows — for example, sending a follow-up notification three days after a WooCommerce order is completed, or alerting a specific team member when a form submission includes a particular keyword. These tools dramatically extend what WordPress email notifications can accomplish without custom code.

Frequently Asked Questions

Why are my WordPress email notifications going to spam?

This usually happens because your server's IP address lacks proper email authentication records. Set up SPF, DKIM, and DMARC DNS records for your domain, and use a dedicated SMTP service like SendGrid or Mailgun instead of PHP's built-in mail function. These services have established sender reputations that inbox providers trust.

What is the best free SMTP plugin for WordPress?

WP Mail SMTP by WPForms is widely regarded as the best free SMTP plugin for WordPress. It supports all major mail providers, includes a built-in email test tool, and offers a configuration wizard that makes setup straightforward even for beginners. The free version covers most use cases for small to medium sites.

How do I change the "From" name and email address in WordPress notifications?

You can change the default From name and email either through the WP Mail SMTP plugin settings (under Settings > From Name and From Email) or by adding a filter in your theme's functions.php file using the wp_mail_from and wp_mail_from_name hooks. Make sure the From email address matches a domain you control and have authenticated with your SMTP provider.

Can I send WordPress email notifications without a plugin?

Yes. If your hosting provider supports authenticated SMTP natively, you can configure it directly in wp-config.php using constants, or use the phpmailer_init action hook to set SMTP credentials programmatically in your theme's functions.php. However, using a plugin like WP Mail SMTP is simpler to maintain, easier to debug, and less likely to break during theme updates.

Properly configured WordPress email notifications keep you and your users informed and build trust in your site's reliability. Whether you opt for a straightforward plugin setup or a custom-coded solution, the steps above give you a solid, production-ready email system. If you would prefer to skip the manual configuration entirely, WP AI Agent is an AI-powered tool that lets you manage tasks like setting up email notifications, configuring SMTP, and customising alerts through simple natural-language chat commands — no technical expertise required.

Ready to manage WordPress with AI?

Get 100,000 tokens free every month. No credit card required.

Get Your Free License Key →

More from the blog