By using this site, you agree to the Privacy Policy
Accept
upupdo upupdo
  • Latest BlogNew
  • Site Setup
    • WordPress
    • Hosting
    • Domain
  • Affiliate
  • Tools
  • Binom
Font ResizerAa
UpUpDoUpUpDo
Search
  • Latest BlogNew
  • Site Setup
    • WordPress
    • Hosting
    • Domain
  • Affiliate
  • Tools
  • Binom
WordPressTroubleshooting

Fix WordPress Not Sending Emails: Use Postfix SMTP on Your VPS

No Comments
Last updated: 2026/06/05
8 Min Read
Share

Recently, while experimenting with WP Mail SMTP, I discovered that most SMTP services using a custom domain are paid. Since I didn’t want to spend money, I had to use Gmail SMTP instead. However, the drawback is that all outgoing emails show my Gmail address as the sender.

If you want to send emails with your own domain name (e.g., [email protected]), the only real solution is to set up your own mail server. Although control panels like aaPanel can configure a full mail server, in many cases we don’t need a complex setup. For a WordPress site, a lightweight SMTP service is enough to handle notification emails, while incoming emails can still be managed by a free business email provider for reliability.

Fix WordPress Not Sending Emails: Use Postfix SMTP on Your VPS


Now let’s build a lightweight mail system that is dedicated to SMTP sending only. We’ll configure Postfix on a VPS, enable DKIM signing, set up the proper SPF record, and walk through the complete process of sending WordPress notification emails successfully.

The goal of this setup is clear:

  • Send only (no incoming mail handling)
  • SMTP only (no IMAP or POP3)
  • No third-party email services required
Why Choose Manual Configuration Instead of aaPanel Mail Server?

The aaPanel mail server is designed to provide a complete email solution, including SMTP (sending) and IMAP/POP3 (receiving). However, my domain’s email is already managed by NetEase free business email, which handles all day-to-day sending and receiving.


Using aaPanel’s mail server would automatically add _domainkey DNS records for DKIM. Since the NetEase business email already has DKIM records with the same prefix, the two systems cannot coexist. Manual configuration allows full control over the DKIM selector and DNS prefix, avoiding conflicts.

Our goal is very clear: we only need a lightweight SMTP server on the VPS. This way, WordPress can send emails reliably, without affecting the existing domain mailbox. It achieves perfect coexistence between the VPS SMTP server and the NetEase domain email service.


Ensure Port 25 Is Open on Your VPS

To send emails directly from your VPS using Postfix, port 25 must be open. This is the standard SMTP port for sending mail to other servers.

⚠️ Important: Some VPS providers block port 25 by default to prevent spam. If port 25 is blocked, you cannot send emails directly from your VPS and must rely on a third-party SMTP service instead.

Installing and Configuring Postfix SMTP on Your VPS
1、Install Postfix

On Ubuntu/Debian:

sudo apt update && sudo apt upgrade
sudo apt install postfix

During the installation, Postfix will prompt you to select a configuration type. Choose Internet Site and enter your domain name (e.g., thuszen.com).

2、Configure Postfix

Edit the main Postfix configuration file /etc/postfix/main.cf and add the following settings:

# TLS parameters
smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname = mail.thuszen.com
myorigin = thuszen.com
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_interfaces = loopback-only
inet_protocols = all

Explanation:

  • myhostname: Set this to your mail server subdomain (e.g., mail.thuszen.com).
  • myorigin = thuszen.com: The default domain for outgoing emails (e.g., [email protected]).
  • mynetworks: Restrict sending to the local network only, preventing abuse.
  • inet_interfaces = loopback-only: Specify which network interfaces the server listens on (loopback-only means only the local loopback interface).
  • inet_protocols = all: Specify which network protocols to support (both IPv4 and IPv6).
Install DKIM to Improve Email Deliverability
1、Install OpenDKIM:
sudo apt install opendkim opendkim-tools
2、Generate the DKIM key pair

It is recommended to create a directory for your domain under /etc/opendkim/keys/:

sudo mkdir -p /etc/opendkim/keys/thuszen.com

Generate the key using wpmail as the selector name (you can customize it to avoid conflicts with NetEase Mail):

cd /etc/opendkim/keys/thuszen.com
sudo opendkim-genkey -s wpmail -d thuszen.com

This will generate two files:

  • wpmail.private → the private key (used by the server for signing)
  • wpmail.txt → the public key (to be added as a DNS TXT record)
Configure OpenDKIM with Postfix

Add the following to /etc/opendkim.conf:

Syslog          yes
UMask           007
Mode            sv
Canonicalization relaxed/simple
SubDomains      no
Selector        default
Domain          thuszen.com
KeyFile         /etc/opendkim/keys/thuszen.com/default.private
Socket          inet:8891@localhost

Add the following lines to /etc/postfix/main.cf:

milter_default_action = accept
milter_protocol = 6
smtpd_milters = unix:/run/opendkim/opendkim.sock
non_smtpd_milters = unix:/run/opendkim/opendkim.sock
Configure DNS Records

A Record:

  • Host/Name: mail
  • Type: A
  • Value: Your VPS public IP address

SPF Record (to improve deliverability and prevent emails from being marked as spam):

  • Host/Name: @
  • Type: TXT
  • Value (send-only via your VPS):v=spf1 ip4:YOUR_VPS_IP ~all
  • Value (coexisting with NetEase Business Email):v=spf1 ip4:209.55.108.38 include:spf.163.com -all

TXT Record:

  • Host/Name: wpmail._domainkey
  • Type: TXT
  • Value: Copy the content inside the parentheses from the wpmail.txt file. Do not include the double quotes twice, and keep the slashes as they are.

_dmarc Record:

NetEase Business Email does not allow modifying the _dmarc record, so it is not configured.

If you are not using another email provider, you can configure a TXT record like this:v=DMARC1; p=none; rua=mailto:[email protected]

At this point, WordPress can successfully send notification emails. Comment notifications, plugin updates, and other automated alerts are all delivered properly.

I have four websites hosted on the same VPS, and each can send notifications using its own domain. For example, emails can appear from or . This setup is not limited to the domain configured in Postfix, giving each WordPress site the flexibility to use its own sender address.[email protected]@oddbbo.com.

You can also use plugins to manage outgoing emails, such as WP Mail SMTP:

  • SMTP Host: localhost
  • Encryption: None
  • SMTP Port: 25
  • Auto TLS: Enabled
  • Authentication: Disabled
Conclusion

During testing, I found that NetEase Business Email cannot receive emails sent from the VPS. The mail logs show:

451 4.3.2 Internal server error

Postfix successfully delivered the email to NetEase’s server, but it was rejected. The recipient inbox does not receive the email, and no bounce message is generated.

Emails sent to 163.com addresses and Alibaba Business Email worked normally. Attempts to contact NetEase support regarding this issue were unsuccessful.

⚠️ Note for Gmail users:
If you want to send emails to Gmail, you must set up a reverse DNS (PTR record) for your VPS. Otherwise, Gmail will reject your messages with:550-5.7.25

host gmail-smtp-in.l.google.com[142.251.2.27] said:
550-5.7.25 [209.54.104.38] The IP address sending this message does not
have a 550-5.7.25 PTR record setup, or the corresponding forward DNS entry
does not 550-5.7.25 match the sending IP. As a policy, Gmail does not
accept messages 550-5.7.25 from IPs with missing PTR records. For more
information, go to 550-5.7.25

Finally, you can use mail-tester.com to check the deliverability score of emails sent from your VPS.

Info

  • About US
  • Contact Us
  • Privacy Policy
TAGGED:Postfix VPS Mail ServerVPS Email NotificationsWordPress SMTP
Share This Article
Facebook Email Print
Previous Article Cache with Automatic Preloading Make WordPress Faster: Supercharge Nginx FastCGI Cache with Automatic Preloading on aaPanel
Next Article Disable WordPress Image Cropping How to Disable WordPress Image Cropping (Including 768px Images)
Leave a Comment Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

A clean and modern infographic showcasing a real-world comparison of budget VPS hosting under $30 per year. The design highlights key specifications such as 3 vCPU CPU, 4GB RAM, SSD storage, and global server locations including Los Angeles, San Jose, and New York. It represents a practical performance review of RackNerd and ColoCrossing VPS plans based on real usage scenarios like WordPress hosting and tracking systems.
Best Budget VPS Under $30/Year: RackNerd vs ColoCrossing Real Performance Test
1 month ago
Clean WordPress feature image with a pastel frosted gradient background, visualizing a VPS network outage caused by an incorrect default gateway. Red and green routing paths compare a failed connection and a working connection, highlighting a simple but critical configuration error.
My New ColoCrossing VPS Was Offline From Day One — The Default Gateway Was Wrong
1 month ago
Side-by-side comparison of cloud and self-hosted affiliate tracking systems, showing a simple cloud tracker dashboard versus a Binom self-hosted server setup for media buying and performance tracking.
Self-Hosted vs Cloud Affiliate Trackers: Why More Affiliates Are Using Binom
2 months ago
Binom has long been recognized as the "King of Self-Hosted Trackers" thanks to its insane processing efficiency and powerful customization features.
The King of Trackers — A Complete Binom Configuration Guide for Beginners
2 months ago
Best WordPress Permalink Settings for Beginners
Best WordPress Permalink Settings for Beginners (SEO Guide + Fixing 404 Errors)
4 months ago

Related

Elementor Explained
WordPressTheme & Design

Elementor Explained: The Revolutionary Visual Builder for WordPress

10 months ago
Understanding WordPress Themes and Appearance
WordPressBasic Tutorials

Understanding WordPress Themes and Appearance

7 months ago
WordPressBasic Tutorials

Discover WordPress: The World’s Most Popular Website Builder Explained

1 year ago
A Comprehensive Guide to WordPress Media Library
WordPressBasic Tutorials

A Comprehensive Guide to WordPress Media Library

7 months ago

upupdo upupdo

Up your site, do it right.

  • About US
  • Contact Us
  • Privacy Policy
  • Foyoy Games
  • OddbbO Finds
  • OddbbO World
  • SoEZ World

Copyright © 2026 UpUpDo | Powered by ThusZen

Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?