Having issues with WordPress not sending emails? This problem can affect contact forms, password reset emails, and other important communications from your website. The good news is that you can fix this by configuring WordPress to send emails using Gmail’s SMTP server. This step-by-step guide will show you how to set up Gmail SMTP in WordPress to ensure your emails reach their destination.
Understanding the Email Issue in WordPress
By default, WordPress uses the PHP mail function to send emails. However, many hosting providers don’t have this function configured correctly or disable it to prevent abuse, which leads to emails not being sent. Even if emails are sent, they might end up in spam folders because they aren’t authenticated properly.
Why Use Gmail’s SMTP Server?
SMTP (Simple Mail Transfer Protocol) is the industry standard for sending emails reliably. By connecting your WordPress site to Gmail’s SMTP server, you can authenticate your emails and improve deliverability. This means your emails are more likely to land in the inbox rather than the spam folder.
Installing the WP Mail SMTP Plugin
To start, you’ll need to install and activate the WP Mail SMTP plugin, which allows WordPress to send emails using SMTP instead of the PHP mail function.
Step 1: Install WP Mail SMTP Plugin
Log in to your WordPress dashboard. Navigate to Plugins > Add New. In the search bar, type WP Mail SMTP. Once you find the plugin by WPForms, click on Install Now, then activate it.
Step 2: Run the Setup Wizard
After activation, the plugin will prompt you to run the setup wizard. Click on Let’s Get Started to begin the configuration process.
Configuring WP Mail SMTP with Gmail
Step 3: Choose Gmail as Your Mailer
In the mailer selection step, choose Gmail. This option allows you to send emails through Gmail’s API, which is more secure and reliable than traditional SMTP. Click Save and Continue.
Note: Gmail’s API is suitable for sites sending a low volume of emails. If you anticipate sending a large number of emails, you might consider an alternative SMTP service.
Step 4: Set Up a Google Cloud Project
To authenticate with Gmail, you’ll need to create a project in the Google Cloud Platform and obtain OAuth 2.0 credentials.
a) Create a New Project
Visit the Google Cloud Console. If you haven’t created a project before, you’ll see an option to Create Project. Click it, give your project a name (e.g., WP Mail SMTP), and then click Create.
b) Enable Gmail API
With your project selected, click on the navigation menu (three horizontal lines) in the top-left corner and navigate to APIs & Services > Library. In the search bar, type Gmail API. Click on the Gmail API result, then click Enable.
Step 5: Create OAuth Credentials
Now, you’ll create the credentials needed for WP Mail SMTP to connect to your Gmail account.
a) Configure OAuth Consent Screen
In the APIs & Services dashboard, click on OAuth consent screen from the left sidebar. Choose External as the user type and click Create.
Provide an App name (e.g., WP Mail SMTP), and enter your email address in the User support email field. Optionally, add your logo and other details. In the Developer contact information section, enter your email address. Click Save and Continue.
You can skip the scopes and test users sections by clicking Save and Continue and then Back to Dashboard.
b) Publish the App
In the OAuth consent screen dashboard, under Publishing status, click Publish App, then confirm. This will remove the app from testing mode.
c) Create OAuth Client ID
From the left sidebar, click on Credentials, then click Create Credentials > OAuth client ID. Select Web application as the application type.
Under Authorized redirect URIs, you’ll need to add the redirect URI provided by the WP Mail SMTP plugin. Go back to your WordPress dashboard, and in the WP Mail SMTP setup wizard, you’ll find the redirect URI listed. Copy it.
Return to the Google Cloud Console and click Add URI under Authorized redirect URIs. Paste the URI you copied. Click Create.
Step 6: Obtain Client ID and Client Secret
After creating the OAuth client, you’ll be presented with your Client ID and Client Secret. Copy both keys.
Step 7: Connect WP Mail SMTP to Gmail
Back in the WP Mail SMTP setup wizard, paste the Client ID and Client Secret into the respective fields. Click Save and Continue.
Step 8: Authorize the Connection
WP Mail SMTP will now attempt to connect to your Gmail account. Click on the Allow plugin to send emails using your Google account link. You may need to sign in to your Gmail account.
Google may display a warning because the app hasn’t been verified. Click on Advanced, then click Go to WP Mail SMTP (unsafe). This is safe because you’re the one who created the app. Grant the necessary permissions by clicking Allow.
Once authorized, you’ll see a success message in WP Mail SMTP.
Configuring Email Settings
Now, you can configure the email settings in WP Mail SMTP.
Set the From Email to your Gmail address or the address you want emails to be sent from. You can choose to force this email address for all emails sent from WordPress.
Set the From Name to the name you want your emails to display.
Click Save Settings to finalize the configuration.
Testing Your Email Configuration
To ensure everything is working, you can send a test email.
In your WordPress dashboard, go to WP Mail SMTP > Tools. Under the Email Test tab, enter an email address to send a test email to (preferably an address you have access to). Click Send Email.
If everything is configured correctly, you’ll see a success message, and the test email will arrive in the specified inbox.
Conclusion
By following these steps, you’ve successfully configured your WordPress site to send emails using Gmail’s SMTP server. This should resolve any issues with emails not being sent and improve the deliverability of your site’s emails.
WP Mail SMTP is a powerful plugin developed by WPForms, a company known for their user-friendly WordPress plugins. With over 3 million active installations and a 4.8 out of 5-star rating on the WordPress Plugin Directory, WP Mail SMTP is a trusted solution for email deliverability issues.
Remember that Gmail imposes sending limits, which are sufficient for most small to medium websites. If your site sends a high volume of emails, consider using a dedicated SMTP service provider.
A Fun Twist at the End
Well, that was quite a ride through the digital meadows of WordPress and Gmail! Setting up SMTP might seem like a mountain to climb, but with the right steps, it’s more like a pleasant hike. Just like how yaks navigate rugged terrains with ease, you too can steer through technical setups without breaking a sweat. Happy emailing!