WordPress Development

WP Mail SMTP & Google API Setup: Fixing WordPress Email Delivery

A WordPress contact form can work perfectly on the front end while email notifications fail in the background. I came across this issue while testing a WordPress setup where form submissions were successful, but the expected email notifications were not reaching the inbox.

To improve the email delivery process, I configured WP Mail SMTP with Google/Gmail authentication using the Google Cloud Console.

Finding the Email Delivery Issue

The first step was checking whether the problem was with the form or the email delivery system.

The form was submitted correctly, but the notification email was not being delivered reliably. This showed that the form itself was working, while the email delivery process needed further investigation.

I decided to use WP Mail SMTP instead of relying only on the website’s default WordPress mail configuration.

Testing email delivery from the WP Mail SMTP dashboard.

Setting Up WP Mail SMTP

The setup involved connecting WordPress with Google’s authenticated email system.

The main steps were:

  • Installed and configured WP Mail SMTP
  • Selected Google/Gmail as the mailer
  • Created a project in Google Cloud Console
  • Enabled the Gmail API
  • Created OAuth credentials
  • Added the required redirect URI
  • Connected the Google account through OAuth
  • Tested email delivery

This created a simple communication flow:

WordPress, WP Mail SMTP, Google Authentication, Gmail, and finally the recipient’s inbox. 

Google Cloud & Gmail API Configuration

The Google Cloud Console was used to create the API environment required for the connection.

I enabled the Gmail API and created OAuth credentials for the web application. The redirect URI was then configured according to the requirements provided by WP Mail SMTP.

OAuth authentication was useful because the setup could connect the website with Google without simply storing an email account password in the WordPress mail configuration.

Gmail API enabled in Google Cloud Console for the WordPress email integration.

For security, sensitive information such as Client Secrets and private credentials should never be published in screenshots or website articles.

Testing the Email Delivery

After completing the configuration, I performed a test email from the WordPress website.

I checked whether:

  • The test email was sent successfully
  • The message reached the intended inbox
  • The sender information was correct
  • The email content was displayed properly

The test helped confirm that the complete email delivery flow was working as expected.

Successful test email received after configuring WP Mail SMTP.

What I Learned

This project helped me understand an important part of WordPress troubleshooting: a successful form submission does not always mean successful email delivery.

Through this setup, I gained practical experience with:

  • WP Mail SMTP
  • Google Cloud Console
  • Gmail API
  • OAuth 2.0
  • WordPress email configuration
  • Website troubleshooting

Reliable email delivery is also important for digital marketing because contact forms often generate enquiries and leads. If an email notification fails, an important enquiry can easily be missed.

Final Takeaway

This practical setup helped me understand how WordPress, WP Mail SMTP, Google APIs, OAuth authentication, and Gmail work together to handle website emails.

It was a useful technical project that connected my digital marketing knowledge with practical WordPress and website optimization.

This project is also part of my practical work as a Digital Marketing Strategist in Palakkad, where I focus on SEO, website optimization, content, and digital marketing.