One of my clients—a B2B media platform running on WordPress—was facing a common but frustrating issue: WordPress emails weren’t being delivered reliably. Contact form submissions, user notifications, and automated emails were either landing in spam or not arriving at all.
The default wp_mail() function relies on PHP mail, which many hosting providers configure poorly. Spam filters often distrust these emails.
Why Google OAuth Instead of App Passwords?
While App Passwords still work, OAuth is Google’s recommended authentication method because it is more secure and doesn’t require storing your Gmail password in WordPress.
- No password stored in WordPress
- Token-based authentication
- Works with Google Workspace
- Supported by WP Mail SMTP
What You’ll Need
- Google Cloud Console account
- WP Mail SMTP plugin
- Gmail or Google Workspace account
Step 1: Create a Google Cloud Project
- Open Google Cloud Console.
- Create a new project.
- Give it a name such as
wordpress-mailer.
Step 2: Enable Gmail API
- Go to APIs & Services → Library.
- Search for Gmail API.
- Click Enable.
Step 3: Configure the OAuth Consent Screen
Branding
- App Name
- User Support Email
- Developer Contact Email
Audience
- Leave the app in Testing mode.
- Add your Gmail account under Test Users.
Important: If you don’t add the Gmail account as a Test User, you’ll receive Error 403: access_denied during authorization.
Step 4: Create OAuth Credentials
- Create an OAuth Client.
- Select Web Application.
- Add the following Authorized Redirect URI:
https://connect.wpmailsmtp.com/google/
Copy the generated Client ID and Client Secret.
Step 5: Configure WP Mail SMTP
- Open WP Mail SMTP → Settings.
- Select Google / Gmail.
- Paste the Client ID and Client Secret.
- Save the settings.
- Authorize your Google account.
Step 6: Send a Test Email
Go to WP Mail SMTP → Tools → Email Test and send a test email.
Do You Need to Publish the OAuth App?
No. For most WordPress websites, Testing mode is sufficient. You can authorize up to 100 test users without publishing the app.
Common Error: 403 access_denied
Fix: Go to Audience → Test Users, add the Gmail account you’re authorizing, and save the changes.
PHP Mail vs Gmail SMTP
| PHP Mail | Gmail SMTP |
|---|---|
| Poor deliverability | Excellent deliverability |
| No authentication | OAuth authentication |
| Often marked as spam | Better inbox placement |
| Hosting dependent | Google infrastructure |
Final Thoughts
This setup took less than 30 minutes and completely solved my client’s email delivery problem. If your WordPress website struggles with email deliverability, Gmail SMTP with Google OAuth is one of the best free solutions available today.
Need help setting this up? Feel free to get in touch if you need assistance configuring SMTP or troubleshooting WordPress email issues.











