
WordPress emails going to spam — or not being delivered at all — is one of the most common complaints from website owners. Registration confirmations, password reset links, WooCommerce order notifications, and contact form submissions all rely on a reliable email sending system. This guide walks you through configuring WordPress to send email via SMTP on shared hosting, so your emails reach the inbox every time.
This guide covers: why WordPress fails to send emails on hosting, PHP mail() vs SMTP, installing WP Mail SMTP, configuring SMTP with AsiaGB's DirectAdmin email hosting, using Gmail SMTP with App Passwords, setting up SPF/DKIM, and troubleshooting common issues.
1. Why WordPress Fails to Send Emails on Shared Hosting
WordPress sends all emails through its wp_mail() function, which by default relies on PHP's built-in mail() function. On shared hosting, this approach creates multiple problems that result in emails either not being delivered or landing in spam folders.
Root Causes of WordPress Email Failures
- Shared IP address reputation: On shared hosting, hundreds of websites share the same IP address. If any one of them sends spam, the IP gets blacklisted — and your emails get blocked too, even though you did nothing wrong.
- No authentication: PHP mail() sends email without any login or verification process. Receiving mail servers cannot confirm you are who you claim to be, so they treat the email as suspicious.
- Missing Reverse DNS (PTR record): Many hosting servers lack properly configured PTR records. Mail servers use this to verify that the sending IP corresponds to a legitimate domain.
- No SPF or DKIM records: Without these DNS records, Gmail, Outlook, and other major mail providers automatically route your email to spam or reject it outright.
- Port 25 blocked: Most ISPs and hosting providers block outbound Port 25 to prevent spam. Since PHP mail() relies on Port 25 via sendmail, it silently fails on many servers.
- Misconfigured sendmail or Postfix: Some servers lack sendmail entirely, or it is configured incorrectly, causing PHP mail() to return false without any visible error message.
The solution is to use SMTP (Simple Mail Transfer Protocol) instead. SMTP requires authentication with a username and password, uses encrypted connections, and sends through a reputable mail server — all of which dramatically improve deliverability.
2. PHP mail() vs SMTP: Key Differences Explained
Understanding why SMTP outperforms PHP mail() helps clarify why this configuration change is worth making, even if your site is small.
PHP mail() — The Legacy Approach with Significant Drawbacks
- Sends email directly from the server with no authentication step
- Uses the server's local sendmail or Postfix installation
- No encryption — email content travels as plain text over the network
- Minimal logging — difficult to diagnose why emails are failing
- High spam folder placement rate, especially on shared hosting
- No automatic retry on delivery failure
- From address can be inconsistent or spoofed-looking
SMTP — The Industry Standard for Reliable Email
- Requires login credentials (username + password) before sending — proves identity to receiving servers
- Supports SSL/TLS and STARTTLS encryption for secure transmission
- Sends through reputable mail servers such as Gmail, Outlook, or AsiaGB's DirectAdmin email hosting
- Detailed delivery logging — you can see exactly what happened to every email
- Far higher inbox delivery rates compared to PHP mail()
- Fully compatible with SPF and DKIM authentication
- Meaningful error messages when delivery fails
Key takeaway: SMTP is the industry standard for transactional email. If your website depends on email to communicate with users — for registrations, orders, or support — switch from PHP mail() to SMTP immediately. There is no good reason to keep using PHP mail() on a production site.
3. Installing and Configuring WP Mail SMTP Plugin
WP Mail SMTP by WPForms is the most widely used plugin for fixing WordPress email delivery. With over 4 million active installations and a robust free tier, it covers the needs of most websites without requiring a paid license.
Installation Steps
- Log in to your WordPress Admin → Plugins → Add New
- Search for "WP Mail SMTP" in the search box
- Find "WP Mail SMTP by WPForms" and click Install Now
- Once installed, click Activate
- A Setup Wizard will appear — you can skip it to configure settings manually
- Navigate to WP Mail SMTP → Settings in the left sidebar
Configure From Email and From Name
In the General settings section, configure these critical fields first:
- From Email: Enter the email address you want recipients to see in the "From" field. Use an address on your own domain, such as
[email protected]or[email protected]. This is essential for SPF and DKIM to work correctly. - From Name: Enter your business name or website name as you want it to appear to recipients.
- Force From Email: Enable this to override other plugins that may set their own From address, ensuring consistency across all WordPress emails.
- Force From Name: Enable this for the same reason — prevents inconsistent sender names.
Choosing a Mailer
WP Mail SMTP supports multiple mailer options. Choose based on your setup:
- Other SMTP — Best for AsiaGB's DirectAdmin email hosting or any standard SMTP server you control
- Gmail / Google Workspace — For Gmail accounts or Google Workspace business email (requires App Password)
- Outlook / Office 365 — For Microsoft email accounts
- SendGrid, Mailgun, Amazon SES — Dedicated email delivery services for high-volume sending
- PHP mail() — The default we're replacing (not recommended)
4. Setting Up SMTP with AsiaGB's DirectAdmin Email Hosting
If your website is hosted with AsiaGB, you already have an email account on your own domain and can use it as your WordPress SMTP server at no additional cost. This is the recommended approach for business websites — email comes from your own domain name, which looks professional and builds trust with recipients.
Step 1: Create an Email Account in DirectAdmin
- Log in to DirectAdmin at
yourdomain.com:2222 - Under E-Mail Manager, click "Create Mail Account"
- Enter a username such as
noreplyorwordpress - Set a strong password (mix of uppercase, lowercase, numbers, and symbols)
- Set a Quota of 50MB — this is sufficient since outgoing mail is not stored in this mailbox
- Click Create to finish
Step 2: Find Your SMTP Server Settings
AsiaGB DirectAdmin SMTP settings are typically:
- SMTP Host:
mail.yourdomain.com(or the server hostname from your welcome email) - SMTP Port:
587(STARTTLS, recommended) or465(SSL/TLS) - Encryption:
TLSfor Port 587,SSLfor Port 465 - Authentication: Enabled
- SMTP Username: Full email address, e.g.
[email protected] - SMTP Password: The password you set in DirectAdmin
Step 3: Enter Settings in WP Mail SMTP
- Go to WP Mail SMTP → Settings
- Under the Mailer section, select "Other SMTP"
- Fill in all SMTP fields as above
- Enable Auto TLS
- Enable Authentication
- Enter your SMTP Username and Password
- Click Save Settings
SMTP Host: mail.yourdomain.com SMTP Port: 587 Encryption: TLS Auto TLS: On Authentication: On SMTP Username: [email protected] SMTP Password: [Password set in DirectAdmin]
Note: If mail.yourdomain.com does not work, try using yourdomain.com as the SMTP host. You can also find the correct mail server hostname in the welcome email AsiaGB sent when you created your hosting account.
5. Using Gmail SMTP with WordPress (App Password Method)
You can use a Gmail or Google Workspace account as your WordPress SMTP server. However, since 2022 Google no longer allows third-party apps to authenticate with your regular Gmail password. You must use an App Password instead — a separate 16-character code generated specifically for each app you authorize.
Prerequisites
- Your Google account must have 2-Step Verification enabled — the App Password option only appears after 2FA is active
- For Google Workspace accounts, the workspace admin may need to enable "Less secure apps" or configure OAuth2
Creating a Gmail App Password
- Visit
myaccount.google.comand log in to your Google account - Click Security in the left menu
- Scroll to "2-Step Verification" and click it
- Scroll to the bottom of the page and find "App passwords"
- In the "Select app" dropdown, choose "Mail"
- In the "Select device" dropdown, choose "Other (Custom name)"
- Type "WordPress SMTP" as the name and click Generate
- Google displays a 16-character password — copy it immediately (it is shown only once)
Configuring Gmail SMTP in WP Mail SMTP
SMTP Host: smtp.gmail.com SMTP Port: 587 Encryption: TLS Authentication: On SMTP Username: [email protected] SMTP Password: 16-character App Password (remove spaces)
Save settings and run a test email. Free Gmail accounts allow approximately 500 emails per day. Google Workspace accounts allow up to 2,000 emails per day. For higher volumes, consider a dedicated email delivery service.
Limitations of Gmail SMTP for WordPress
- The sender name displayed to recipients comes from your Google Account profile name, not your business name (unless using Google Workspace with a custom alias)
- The From address shows your Gmail address, not your website domain — which may look unprofessional
- Google may revoke App Passwords if it detects unusual activity
- Changing your Google account password invalidates all App Passwords
Recommendation: For business websites, using AsiaGB's DirectAdmin email hosting (Section 4) is preferable to Gmail SMTP because emails come from your own domain, look more professional, and are not subject to Google's daily sending limits.
6. Testing WordPress Email Delivery
Thorough testing after configuration is essential — do not skip this step. Test multiple scenarios to confirm every type of email your website sends actually works end-to-end.
Test Using WP Mail SMTP's Built-in Tool
- Go to WP Mail SMTP → Tools → Email Test
- Enter a recipient email address — test with both a Gmail and Outlook address if possible
- Click Send Test Email
- Check both the inbox and spam folder at the recipient address
- Review WP Mail SMTP → Email Log for delivery status (if Email Log is enabled)
Test Real WordPress Email Functions
After confirming the test email works, verify that actual WordPress functionality sends correctly:
- Register a new user account — confirm the Welcome Email arrives
- Trigger the Forgot Password flow — confirm the Reset Password Email arrives
- If using WooCommerce, place a test order — confirm the Order Confirmation Email arrives
- Submit a contact form (Contact Form 7, WPForms, etc.) — confirm the notification arrives at the admin email
- If using a membership plugin, test the subscription confirmation email
Reading Email Headers to Verify Authentication
Open a received test email in Gmail, click the three-dot menu, then "Show original." Look for the Authentication-Results line. A properly configured SMTP setup should show:
spf=pass (SPF check passed — email came from authorized IP) dkim=pass (DKIM signature valid — email not tampered with) dmarc=pass (DMARC policy satisfied)
If any of these show "fail" or "none", configure SPF and DKIM as described in the next section.
7. Configuring SPF and DKIM to Avoid Spam Filters
Even with SMTP properly configured, emails can still end up in spam if your domain lacks SPF and DKIM records. Since early 2024, Google and Yahoo require bulk senders to have SPF, DKIM, and DMARC configured — and even for smaller senders, these records dramatically improve inbox placement.
Setting Up SPF (Sender Policy Framework)
SPF is a DNS TXT record that lists which IP addresses or mail servers are authorized to send email from your domain. Receiving mail servers check SPF before accepting email.
To add an SPF record in DirectAdmin:
- Log in to DirectAdmin → DNS Management → Add Record
- Type: TXT
- Name: @ (representing your root domain)
- Value: depends on which servers you send from
SPF for DirectAdmin email hosting only:
v=spf1 include:_spf.yourdomain.com ~all
SPF for both DirectAdmin and Gmail:
v=spf1 include:_spf.yourdomain.com include:_spf.google.com ~all
Understanding SPF mechanisms:
~all(SoftFail) — Emails from unauthorized IPs are marked suspicious but still delivered. Good for testing.-all(HardFail) — Emails from unauthorized IPs are rejected outright. Use once you are confident SPF is correct.
Setting Up DKIM (DomainKeys Identified Mail)
DKIM adds a cryptographic signature to every email your server sends. The receiving mail server retrieves your public key from DNS and uses it to verify the signature, confirming the email was not altered in transit.
To enable DKIM in AsiaGB's DirectAdmin:
- Log in to DirectAdmin → E-Mail Manager → DomainKeys (DKIM)
- If a key already exists, copy the displayed TXT record
- If no key exists, click "Generate New Key"
- Add the generated TXT record to your domain's DNS under the name
default._domainkey.yourdomain.com - Allow up to 24 hours for DNS propagation before testing
Adding a DMARC Record
DMARC tells receiving mail servers what to do with emails that fail SPF or DKIM checks, and sends you reports about email activity on your domain.
Start with a monitoring-only policy (p=none):
Name: _dmarc.yourdomain.com Type: TXT Value: v=DMARC1; p=none; rua=mailto:[email protected]
Once you have confirmed SPF and DKIM are working via email header inspection, you can tighten the policy:
v=DMARC1; p=quarantine; rua=mailto:[email protected] # or the strictest option: v=DMARC1; p=reject; rua=mailto:[email protected]
Verify SPF/DKIM/DMARC with Online Tools
Use MXToolbox SuperTool at mxtoolbox.com/SuperTool to check SPF, DKIM, and DMARC records for your domain. Mail Tester at mail-tester.com gives you a spam score out of 10 and explains exactly what needs improvement.
8. Troubleshooting Common WordPress Email Issues
Even with a correct SMTP configuration, you may encounter issues. Here are the most frequently seen problems and how to resolve them effectively.
Error: "SMTP Error: Could not connect to SMTP host"
- Wrong hostname — verify SMTP host from your welcome email or DirectAdmin interface
- Port blocked — try switching from 587 to 465 (or vice versa)
- SSL/TLS mismatch — Port 587 uses TLS (STARTTLS), Port 465 uses SSL
- Hosting firewall blocking outbound connections — open a support ticket with AsiaGB
Error: "SMTP Error: Password command failed"
- Incorrect password — reset the email account password in DirectAdmin and update WP Mail SMTP
- Username format wrong — must be the full email address including @domain
- Account locked or suspended — check the email account status in DirectAdmin
Emails Sending but Landing in Spam
- SPF record missing or incorrect — add/fix SPF as described in Section 7
- DKIM not configured — enable DKIM in DirectAdmin and add the DNS record
- From email domain does not match sending domain — always use From Email on your own domain
- Spam trigger words in subject line — avoid "Free", "Urgent", "Click here", "Limited offer" in subject lines
- SMTP server IP is blacklisted — check at
mxtoolbox.com/blacklists
WooCommerce Order Emails Not Sending
- Go to WooCommerce → Settings → Emails and verify each email type is enabled
- Check the Recipient field in each Email Type — make sure your admin email is correct
- Click "Send test email" in each Email Type to test individually
- Check the WP Mail SMTP Email Log for specific error messages
Contact Form 7 or WPForms Not Sending Notifications
WP Mail SMTP overrides wp_mail(), which both CF7 and WPForms use. If SMTP is correctly configured, these forms should work automatically. Check:
- The To address in your form settings is correct and active
- CF7 Flamingo or Akismet is not blocking submissions as spam
- WP Mail SMTP Email Log shows whether the form is triggering wp_mail() at all
Enabling Debug Mode for Detailed Error Messages
Add these lines to wp-config.php to capture detailed error output:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
View the log at wp-content/debug.log. WP Mail SMTP Pro also provides a built-in Email Log with full error context.
9. Frequently Asked Questions
Q: Is the free version of WP Mail SMTP good enough for my website?
A: Yes, for most websites the free version handles everything you need. It supports general SMTP, Gmail, and Outlook mailers, includes a test email feature, and works transparently with all other plugins that use wp_mail(). The Pro version adds email logging with delivery status, failure alerts, and priority support — worth considering for e-commerce or membership sites where email delivery is business-critical.
Q: How many emails can I send per day using AsiaGB's DirectAdmin SMTP?
A: Shared hosting environments have per-hour email sending limits to prevent spam abuse. For typical transactional email (registrations, orders, contact forms), normal usage should stay well within limits. For bulk newsletters or mass notifications, use a dedicated email delivery service such as Brevo, Mailchimp, or SendGrid alongside your transactional SMTP setup.
Q: Does my site need an SSL certificate before setting up SMTP?
A: No — your website's HTTPS certificate and SMTP encryption are independent. SMTP encryption (TLS on Port 587 or SSL on Port 465) operates at the mail protocol level, not the web server level. You can configure SMTP on a non-HTTPS site. That said, installing SSL on your website is strongly recommended for overall security.
Q: What alternative SMTP plugins are available besides WP Mail SMTP?
A: FluentSMTP is a strong free-only alternative with no premium upsell. Post SMTP Mailer/Email Log has excellent delivery logging. Easy WP SMTP is simpler and lightweight. WP Mail SMTP remains the most popular choice due to its active development and large community support base.
Q: Should I use DirectAdmin SMTP or Gmail SMTP for my business website?
A: For business websites, DirectAdmin email hosting is the better choice. Email comes from your own domain (such as [email protected]), looks professional, builds brand trust, and is not subject to Google's sending limits. Gmail SMTP is fine for personal projects or sites where the from address does not need to match your business domain.
Get Reliable WordPress Hosting with Email Included
AsiaGB shared hosting includes DirectAdmin, SSD storage, 99% uptime, and email hosting on your own domain starting at just 500 THB/year.
Get Started with Hosting