If you are running a WordPress eCommerce website, you want to ensure that your emails are delivered to your customers promptly. However, due to how the WordPress core is developed, sending emails from the website is a nightmare for many users. I had issues where the email was never sent at all. In other instances, the email was sent but the delivery ended up in the spam box of the recipient.
Before you can correct the issue with the email delivery, it is ideal you understand the problem that hinders WordPress email delivery. By default, emails going out from a fresh WordPress site are sent from firstname.lastname@example.org (where TLD is your domain extension – .com, .net, .biz, etc.). The PHP mail() function also relies on your WordPress server to send out emails. Your current web hosting can determine if your emails can be sent or not from a WordPress blog or site.
Several web hosting servers have been misused by spammers to send out unsolicited mail to users. For this reason, their IP addresses are marked as spam. If you are on a shared web hosting provider, you may experience this problem. It is a good idea to get yourself a VPS or a dedicated server hosting because you will be allocated a unique IP for your eCommerce store.
Also, depending on your host configurations, emails from WordPress may fail to send because you do not have the address email@example.com on the server. Creating this account will not solve the problem of your emails being marked as spam either. Your only solution is to use an authentication service to send emails by SMTP.
Setting Up SMTP for WordPress Emails
SMTP (Simple Mail Transfer Protocol) is a mechanism you use to authenticate all outgoing emails to ensure that they are signed by the server before sending. By authenticating via SMTP, you are sending your emails from a real user account, and your emails will be less likely to be marked as spam. WordPress can send emails by SMTP with an authentication plugin that connects your site mail() function with a valid email server.
Of the various WordPress SMTP plugins I tried out on my blog, only one worked for me. Maybe some others can work for you. Let us see how to set up SMTP for WordPress to ensure email delivery from your site.
About Gmail SMTP
Gmail, the email service by Google, allows you to send out secure emails to your subscribers and customers directly from your site by authenticating via SMTP. The Gmail SMTP connects your website wp_mail function with Gmail securely through the OAuth 2.0 protocol. In this way, you do not need to save your SMTP password on your WP dashboard.
Here are a few benefits of the Gmail SMTP plugin for sending out email via SMTP:
- The OAuth connection invalidates the need to enter your SMTP username and password.
- Connecting via OAuth 2.0 also ensures that you bypass the Gmail less secure apps limitation when connecting via SMTP.
- You secure your messages with TLS/SSL to prevent eavesdropping by email hackers.
- The plugin does not override the core mail function on your WP website, so other plugins and functions that may depend on the function will still work correctly.
Setting Up the Gmail SMTP
To use the service of the Gmail SMTP, you need to ensure that you have a WordPress website running on your dedicated, VPS, or shared hosting account. You cannot use it with the WordPress.com blogs. You also need a working Gmail account for the authentication.
Once you ensure that you have these things ready, go ahead and install the Gmail SMTP plugin for your WP. Log in to your dashboard, and go to the plugins page. Click on the “Add new” button. In the search box, enter “Gmail SMTP” without the quotes. Install the plugin with the exact name (shown in the image below). You can also get the plugin here and upload it on your plugins dashboard.
After the installation, activate the plugin. Now go to your dashboard, under settings, click on the Gmail SMTP link. To create the credentials you need, go to https://console.developers.google.com and log in with your Gmail account.
Creating and Connecting the App
Once you log in to your Google Console, you will see the button asking you to create a project. If you already have other apps in your account, you can find them under the credentials page.
Now you need to enable API to facilitate communication from your blog. Click the “Enable API and Services” link, and choose the Gmail API from the list of several Google services. Then click the “Enable” button on the page that loads.
Click the “create Credentials” button to set up the authentication. Now follow the “Client ID” link from the page. Do not fill the wizard.
Click on the “Configure consent screen” button.
Fill in the information of your company or website. Then click the “SAVE” button.
Now on the page that loads, choose the web application. Enter a unique name for the authentication ID you are creating. You can use a name that you can easily remember associated with your website.
Now go back to your Gmail SMTP plugin settings page and copy the “Authorized redirect URI” and paste it on your Google console and hit the “ENTER” key BEFORE you click the “Create” button.
Now copy your client ID and the Secret to your plugin setting page. Fill the other information required on the plugin like the authenticated email address, your preferred “from” email and name. The “From” email and the name you provide will appear on your customer’s inbox when your WordPress sends them an email through your authenticated Gmail account.
Click the “Authorize” button on the plugin page, log in to your Google account and give access. Google will warn you that the ap is not trusted, but click on the “Advanced” option and continue. You already trust yourself :). After granting access, your app will be ready to send an email.
Test Your WordPress Email
You can try sending a sample email from the plugin page.
If you are using Google Suite for your domain, use that account to ensure that your emails are sent from your domain name.