Configure WordPress SMTP on Hosting

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

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

SMTP — The Industry Standard for Reliable Email

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

  1. Log in to your WordPress Admin → Plugins → Add New
  2. Search for "WP Mail SMTP" in the search box
  3. Find "WP Mail SMTP by WPForms" and click Install Now
  4. Once installed, click Activate
  5. A Setup Wizard will appear — you can skip it to configure settings manually
  6. 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:

Choosing a Mailer

WP Mail SMTP supports multiple mailer options. Choose based on your setup:

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

  1. Log in to DirectAdmin at yourdomain.com:2222
  2. Under E-Mail Manager, click "Create Mail Account"
  3. Enter a username such as noreply or wordpress
  4. Set a strong password (mix of uppercase, lowercase, numbers, and symbols)
  5. Set a Quota of 50MB — this is sufficient since outgoing mail is not stored in this mailbox
  6. Click Create to finish

Step 2: Find Your SMTP Server Settings

AsiaGB DirectAdmin SMTP settings are typically:

Step 3: Enter Settings in WP Mail SMTP

  1. Go to WP Mail SMTP → Settings
  2. Under the Mailer section, select "Other SMTP"
  3. Fill in all SMTP fields as above
  4. Enable Auto TLS
  5. Enable Authentication
  6. Enter your SMTP Username and Password
  7. 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

Creating a Gmail App Password

  1. Visit myaccount.google.com and log in to your Google account
  2. Click Security in the left menu
  3. Scroll to "2-Step Verification" and click it
  4. Scroll to the bottom of the page and find "App passwords"
  5. In the "Select app" dropdown, choose "Mail"
  6. In the "Select device" dropdown, choose "Other (Custom name)"
  7. Type "WordPress SMTP" as the name and click Generate
  8. 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

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

  1. Go to WP Mail SMTP → Tools → Email Test
  2. Enter a recipient email address — test with both a Gmail and Outlook address if possible
  3. Click Send Test Email
  4. Check both the inbox and spam folder at the recipient address
  5. 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:

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:

  1. Log in to DirectAdmin → DNS Management → Add Record
  2. Type: TXT
  3. Name: @ (representing your root domain)
  4. 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:

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:

  1. Log in to DirectAdmin → E-Mail Manager → DomainKeys (DKIM)
  2. If a key already exists, copy the displayed TXT record
  3. If no key exists, click "Generate New Key"
  4. Add the generated TXT record to your domain's DNS under the name default._domainkey.yourdomain.com
  5. 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"

Error: "SMTP Error: Password command failed"

Emails Sending but Landing in Spam

WooCommerce Order Emails Not Sending

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:

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

View all cheap Thailand web hosting plans →