How to Set Up WordPress SMTP with Gmail

Sending emails from WordPress can sometimes be unreliable due to server limitations. Using Gmail SMTP ensures your emails are delivered successfully. In this guide, we’ll walk you through how to set up WordPress SMTP with Gmail for better email reliability.

Why Use Gmail SMTP for WordPress Emails?

By default, WordPress uses the PHP mail() function, which can cause emails to land in spam folders or not send at all. Gmail’s SMTP server provides a secure and trusted way to send WordPress emails, ensuring higher deliverability. Some key benefits include:

  • Better email security with Gmail’s authentication
  • Higher inbox placement and lower spam rate
  • Reliability over traditional PHP mail functions

Step-by-Step Guide to Setting Up Gmail SMTP in WordPress

Step 1: Install the WP Mail SMTP Plugin

The easiest way to set up Gmail SMTP in WordPress is by using the WP Mail SMTP plugin. Follow these steps:

  1. Go to WordPress Dashboard → Plugins → Add New.
  2. Search for WP Mail SMTP.
  3. Click Install Now and then Activate.
  4. Go to WP Mail SMTP → Settings in your WordPress dashboard.

Step 2: Configure WP Mail SMTP with Gmail

Once the plugin is installed, follow these steps to configure it:

  • In the WP Mail SMTP settings, set the email “From” address to your Gmail account.
  • Choose Google / Gmail under the “Mailer” section.
  • Click the “Set up SMTP” button.

Step 3: Create a Google App for Authentication

For security reasons, you need to create a Google App to connect WordPress with Gmail. Follow these steps:

  1. Go to the Google Cloud Console and log in.
  2. Select a project or create a new one.
  3. Navigate to APIs & Services → Credentials.
  4. Click on Create Credentials and choose OAuth 2.0 Client ID.
  5. Set up the consent screen, selecting “External” and adding your website details.
  6. Under OAuth 2.0, choose “Web Application” and set Authorized Redirect URLs to your site’s WP Mail SMTP settings page.

Step 4: Obtain Client ID and Client Secret

Once your application is set up:

  • Copy the Client ID and Client Secret.
  • Go back to the WP Mail SMTP settings in WordPress.
  • Paste the credentials into the respective fields.

Step 5: Allow Gmail to Send Emails

After entering your credentials:

  • Click Save Settings.
  • Click Allow Plugin to Send Emails, which takes you to Gmail for authentication.
  • Grant permission to the app and confirm.

Step 6: Test WordPress Email Sending

Now that everything is set up, testing is essential:

  1. In WP Mail SMTP, go to the Email Test tab.
  2. Enter an email address to send a test email.
  3. Click Send Email and check if the email is received.

Final Thoughts

Setting up WordPress SMTP with Gmail helps improve email reliability and ensures crucial messages like password resets and contact form submissions reach your inbox. Although the setup process may seem complicated, taking the time to properly configure your email settings can prevent major email delivery issues in the future.

If you experience any issues, double-check your Google API credentials, re-authenticate Gmail access, and ensure the WP Mail SMTP plugin settings are correctly configured.

Now your WordPress site is sending emails securely using Gmail SMTP! 🚀