If you’re experiencing issues with WordPress failing to send emails – for example, sending forms or other communications – it’s usually due to problems with your server configuration.
Like many web applications, WordPress uses the PHP ()mail function to distribute email and, on a correctly configured server, the feature should work seamlessly without the need for user configuration. However, server hosts may place temporary or permanent restrictions on the use of PHP ()mail to reduce automated spam.
If your WordPress email is not being sent, switch over to SMTP (Simple Mail Transfer Protocol) instead.
Option 1: Use your email account’s SMTP servers
Download, install and activate the WP Mail SMTP plugin from the WordPress repository.
Once activated, click the Settings link (or Settings > Email link in the sidebar) to configure the plugin.
Enter your email address and name and, in the Mailer section, ensure Send all WordPress emails via SMTP is selected. In SMTP Options, complete configuration using your HostPapa email server settings. You can find these by heading to My cPanel in the HostPapa Dashboard and clicking the Email Accounts button.
Scroll down to Email Accounts and click the Set Up Email Client link to view your SMTP settings. Ensure Yes: Use SMTP authentication is checked and enter your SMTP login details.
Click the Save Changes button, then test your settings by entering an email address in the To field under Send a Test Email. Click the Send Test button to proceed. If you do not receive an email, check your SMTP settings.
Option 2: Use Google SMTP email servers
The second option uses a free Gmail account from Google and the company’s SMTP servers. Head over to the Gmail website and set up an account. The following configuration steps work with free Gmail or Google Apps accounts.
Once you have your Gmail account set up, download and install the Gmail SMTP plugin from the WordPress Plugin repository.
Once activated, head to Settings > Gmail SMTP to configure the plugin.
To authorize your WordPress installation to use Google’s email servers, you must create a set of secure credentials. First open a new browser window/tab and visit console.developers.google.com. Log in with your newly created Gmail account details, or another Google account.
Click the My Project link at the top of the screen and, in the panel that appears, click the Add (+) button to create a new project.
Create a name for the project (any name will do) and click the Create button to proceed.
In the sidebar, click Dashboard, then click the Enable APIs and Services link at the top of the screen.
Find and select the Gmail API link, listed under G Suite APIs.
At the top of the screen, if you see an Enable link, click it to proceed. We now need to create access credentials for use with the Gmail API. Select Credentials from the sidebar, then click the Create credentials button.
In the menu that appears, select OAuth client ID.
In the Application type screen, select Web application and then click the Create button. To create an OAuth client ID, you need to first set a product name. Enter a name, then head back to your WordPress admin dashboard.
Copy the contents of the Authorized Redirect URI field into the relevant field of the Gmail API Create client ID page.
The results should look something like this:
Now click the Create button. A set of OAuth client credentials will be displayed on screen.
Copy and paste the Client ID and Client Secret into the plugin’s Settings page.
Proceed to configure the remaining plugin settings.
- OAuth Email Address: The email address that you will use for SMTP authentication. This should be the same email used in the Google Developers Console.
- From Email Address: The email address which will be displayed when sending an email.
- From Name: The name which will be displayed when sending an email.
- Type of Encryption: The encryption which will be used when sending an email (either TLS/SSL). By default, it should be set to TLS.
- SMTP Port: The port which will be used when sending an email. If you choose TLS it should be set to 587. For SSL use port 465 instead.
Click Save Changes to proceed. Click the Grant Permission button that appears.
Enter your Gmail account credentials to authorize the connection.
Check that your SMTP Status now reads Connected. You can now proceed to the Test Email tab to try out the new email connection.
For further questions, or if you need help, please open a support ticket from your HostPapa Dashboard. Follow this link to learn how.