Setting up SMTP in WordPress is easy. We need to add email provider specific SMTP server details, port, and credentials, that’s it. Though it is easier it is not the best way to send emails from WordPress. It is better than using the PHP mail function, which is not reliable and has a high probability of ending up in a spam folder.
Gmail, free or paid (G Suite/Google Workspace) guarantees higher deliverability than other email providers. For a long time, we have used a free Gmail account to send WordPress emails with the same SMTP server based method. The basic flaw with the method is that you need to save your Gmail account credentials in WordPress and that might put your credentials at risk of theft or misuse.
With Gmail’s new API based email integration you can avoid that and enjoy better email deliverability at no cost. Sure there are limitations. With a free Gmail account, you can send only 500 emails a day. Whereas with G Suite (Google Workspace) which is a paid option you can send 2000 emails/day.
Free Gmail SMTP is a good option for a typical business website as it may not cross the email limits. For businesses with active digital marketing campaigns, lead magnets, newsletters, etc a free Gmail is not a suitable option. For a high volume e-commerce website, you need a completely different setup for email delivery. (Check mailgun)
Here we are talking about a typical portfolio or business website which do not have a setup that sends more than 500 emails per day.
How to Set up WordPress Emails with Free Gmail Account
Though setting up SMTP with Google API take longer it compensates that with the security it offers. With this method, you don’t need to save your Gmail credential in WordPress, plus you don’t need to allow less secured apps. On top of that, you don’t need to type in Gmail SMTP server address and port number.
Step 1: Install WP Mail SMTP
Install WP Mail SMTP plugin by WPForms. Activate the plugin, it will open a setup wizard. Click the “Let’s get started” button.
Step 2: Choose Your SMTP Mailer
Choose the “Google / Gmail” option and click “Save and Continue”
Step 3: Configure Mailer Setting
On the next screen, you need to add Client ID, Client Secret, and Authorized Redirect URI. Then to allow this plugin to send emails using your Google account click the “Connect to Google” button and authorize the plugin.
Follow the next steps to get Client ID, Client Secret, and Authorized Redirect URI from Google API.
Step 4) Web App in Your Google Account
Login to your free Gmail account and go to Google Cloud Console.
If you are using google cloud for the first time, it will ask you to agree to the terms of service
Step 5: Create a Project
To create a new project click on the Projects dropdown in the top toolbar. Then click on the “New Project” button.
Add a unique project name and click the “CREATE” button.
Step 6: Enable Gmail API
From your Google Cloud Console sidebar, go to APIs & Services » Library.
Click on “+ ENABLE APIS AND SERVICES”
On the next screen choose the “Email” category or search “Gmail API”
Click on the Gmail API card and Click the “Enable” button
Step 7) Create Application Credentials
You will be redirected to Gmail API’s overview page. Click on the “CREATE CREDENTIALS” button.
On the next screen “Gmail API” select API type and select “User data” as a type of data. Click “Next”.
Step 8: Configure OAuth Consent Screen
Enter app name, user support email, optionally add a logo. Finally, add the developer’s email and click the “SAVE AND CONTINUE” button.
Step 9: Configure OAuth Client ID
Select the Web application option from the Application type dropdown and add a relevant name.
Step 10: Copy Keys
Copy the Client ID and Client Keys from the popup window.
Step 11: Publish status from testing to production
Go to APIs & Services » OAuth consent screen. Under User Type, click on the Make External button.
Step 12: Add Keys in Plugin
Go back to plugin setup wizard in WordPress and add Client ID and Client Secret. Now allow the plugin to send emails using your Google Account.
It will open the Gmail authorization screen where you need to allow google to send emails. Nore that none of your users will see this screen, this is a one-time setup from the admin side.
Step 13: Send a Test Email
Return back to WP Mail SMTP settings page and send a test email.