Setting Up WordPress Gmail SMTP for Reliable Email Delivery

Are you struggling with emails from your WordPress site ending up in spam folders or not being delivered at all? If you're sending important transactional emails, like password resets or order confirmations, you need a dependable solution. That's where Gmail SMTP comes in. We'll guide you through setting up WordPress Gmail SMTP to improve email deliverability.

Why Use Gmail SMTP with WordPress?

Avoid Spam Filters: Default WordPress emails often land in spam because the wp_mail()  function lacks proper header authentication. Major email providers and web hosts may block these emails, leading to poor deliverability.

Security and Reliability: SMTP (Simple Mail Transfer Protocol) provides enhanced security compared to the PHP mail function. Gmail's SMTP server is especially useful for small businesses and websites with moderate traffic due to its reliable and secure nature.

Free Gmail SMTP vs. Google Workspace SMTP

  • Free Gmail SMTP: Suitable for small-scale use, but limited to 500 emails per day and lacks custom domain email addresses.
  • Google Workspace SMTP: Offers a custom domain (e.g., [email protected]), domain verification with SPF, DKIM, and DMARC records, and a daily limit of 10,000 emails. This is a paid service but improves sender reputation significantly.

Prerequisites

Before we start, ensure you have either a Google Workspace account or a Gmail account.

Installing the WP Mail SMTP Plugin

  1. Go to your WordPress dashboard and click 'Plugins' on the left panel.
  2. Click 'Add New' and search for 'WP Mail SMTP'.
  3. Install and activate the 'WP Mail SMTP by WPForms' plugin.

Configuring WP Mail SMTP Settings

  1. Find 'WP Mail SMTP' in your WordPress dashboard and click 'Settings'.
  2. Under 'From Email' and 'From Name', input the email and name you want to appear on your outgoing emails.

Note: If 'From Email' is unavailable, ensure you enable Google Mailer using your Client ID.

Integration Using Gmail's SMTP Credentials

  1. After configuring 'From Email' and 'From Name', select 'Other SMTP' instead of 'Google/Gmail'.

    Input the following details:

    • SMTP Host: smtp.gmail.com
    • Encryption: Choose SSL or TLS for security.
    • SMTP Port: Use 465 for SSL or 587 for TLS.
    • Authentication: Turn this on.
    • SMTP Username: Your Gmail or Google Workspace email.
    • SMTP Password: Your Google account app password.
  2. Save your settings.

You're now ready to use WP Mail SMTP with Gmail as your email sender!

Tip: WP Mail SMTP also works seamlessly with WooCommerce and Contact Form 7. Remember to test sending an email to ensure everything is set up correctly.

Keep in mind, for sending high volumes of emails or if you require professional features, third-party services like Mailgun or SendGrid may be more suitable.

How to Integrate Gmail API for Sending Emails with WP Mail SMTP

If you're looking for a more secure way to send emails from your WordPress site, integrating Gmail API is the solution. Follow these steps to set up Gmail API with the WP Mail SMTP plugin:

Creating a Project in Google Cloud Console

  1. While in your WordPress dashboard, choose Google/Gmail  as your mailer in WP Mail SMTP Settings.
  2. Visit Google Cloud Console and sign in with your Google account.
  3. Click on the New project  button at the top right.
  4. Enter a project name and location, then click Create .

Enabling Gmail API

  1. Go to the APIs & Services  > Library .
  2. In the search box, type “Gmail API” and select it.
  3. Click the Enable  button.

Generating API Credentials

  1. Click on Create Credentials .
  2. Make sure “Gmail API” is selected and choose “User data” for the question about data accessing.
  3. Click Next .

Configuring OAuth Consent Screen

  1. Fill in details like your app name, support email, and developer contact.
  2. Optionally upload an app logo if desired.
  3. Click Save and continue .

Creating OAuth Client ID

  1. Skip the Scopes  configuration by clicking Save and continue .
  2. For the application type, select Web application .
  3. Enter a name for your OAuth 2.0 client ID.
  4. In the Authorized redirect URIs  field, add this URL: https://connect.wpmailsmtp.com/google/  (skip the Authorized JavaScript origins field).
  5. Click Create .

Publishing Your Google App

For Gmail (not Google Workspace):

  1. Navigate to the OAuth Consent Screen  tab.
  2. Click Publish App  and confirm by clicking Confirm .

Connecting Gmail API with WP Mail SMTP

  1. In Google Cloud Console, go to Credentials .
  2. Next to your OAuth client, click the pencil icon to edit.
  3. Copy the Client ID  and Client Secret .

Configuring WP Mail SMTP Plugin

  1. Return to your WordPress dashboard and open WP Mail SMTP plugin settings.
  2. Paste the copied Client ID  and Client Secret  in the respective fields.
  3. Click Save Settings .
  4. Follow the prompt to Allow plugin to send emails using your Google account .

Finalizing the Setup

  1. Log in to your Google account when prompted.
  2. If using Gmail, click Advanced  and proceed to wpmailsmtp.com, then continue.
  3. For Google Workspace users, directly press Continue  to grant permissions.

Your WordPress website is now connected to Gmail SMTP using the Gmail API for secure email sending.

Security Tip: Always keep your Client ID and Client Secret confidential to protect your Google account.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.