Home
/
WordPress Tutorials
/
How to Configure WordPress to Use SMTP For Sending Emails

How to Configure WordPress to Use SMTP For Sending Emails

By default, WordPress uses the PHP Mail function to send emails. However, it is better to use SMTP as it handles sending messages better and you can also use it to send emails from a third-party mailing service.

You can watch our short video on how to configure your SMTP credentials on the server:

Alternatively, follow these steps:

To begin, install a plugin named WP Mail SMTP by following the instructions in our tutorial on how to install WordPress plugins. Once the plugin is installed and activated, a new menu will show up named WP Mail SMTP. You will need to navigate to it to configure WordPress to work with SMTP.

On this page you will see several configuration options available:

Here’s a list of all of them and what they configure:

  • From Email – the email address you want to send emails from – for example, email@yourdomain.com;
  • From Name – the name that your emails will be sent from;
  • Mailer – choose whether you want to use the Default PHP mail() function, a Gmail/Google Workspace account, Mailgun, SendGrid or other SMTP servers. Choosing the Default mode would send the messages using the PHP mail() function without SMTP authentication. The Gmail/Google Workspace, Mailgun and SendGrid options require additional info such as Client ID and Client Secret or API key that should be obtained by the respective provider. The other SMTP server option would prompt you to enter additional configuration details which we would describe below.
  • Return Path – check if you want to match the return path for your emails to the sending email;

If you choose other SMTP servers as a mailer, you would be prompted to add the SMTP server’s configuration settings.

  • SMTP Host – the IP or hostname for your SMTP server. You can find the server hostname for your SiteGround website in Site Tools -> Email -> Accounts -> kebab menu -> Mail Configuration -> Manual Settings tab;
  • SMTP Port – the port your server works on;
  • Encryption – if you have SSL/TLS encryption available for that hostname, select it here;
  • Auto TLS – if your server supports TLS encryption, enable this option;
  • Authentication – check if your SMTP server requires authentication;
  • Username – the email address you want to send emails from – for example, ;
  • Password – the password for the email address you have set in the Username field;

Once you configure those parameters, click Save Settings at the bottom of the page.

How to configure WordPress to use your SiteGround email for sending emails

After you install WP Mail SMTP, navigate to WP Mail SMTP -> Settings in your WordPress wp-admin panel. Select Other SMTP for the Mailer setting and a new section will open below it. Inside that new section fill in the following information:

  • You can find the server hostname for your SiteGround website in Site Tools -> Email -> Accounts -> kebab menu -> Mail Configuration -> Manual Settings tab -> Outgoing server;
  • Encryption – TLS;
  • SMTP Port – 587;
  • Authentication – On;
  • SMTP Username – the email address you want to send emails from – for example, ;
  • Password – the password for the email address you have set in the SMTP Username field;

Then click the Save Settings button to apply the changes.

Always test the functionality of the mail-sending service after making changes to its settings. To do that go to your WordPress admin panel -> WP Mail SMTP -> Tools -> Email Test and send a test message to your email address. If you are not receiving the test message, then you need to verify the configuration settings you applied and ensure they are correct.

How to configure WordPress to use Google/Gmail for sending emails

Once you install WP Mail SMTP, navigate to WP Mail SMTP -> Settings in your WordPress wp-admin panel. There, scroll down to the Mailer section and select Google / Gmail and you will see that you require a Client ID, Client Secret and Authorized redirect URI.

To create these, go to the Google Cloud Console Dashboard and click on My Project at the top of the page and then New Project. Set desired values for Name, Organization and Location and click Create.

Then, in your Google Cloud Console sidebar, go to APIs & Services » Library. Enter “gmail api” in the search field and click the Gmail API result. Click Enable, then on the new page that opens click Create Credentials at the top right of the page. Select Gmail API from the drop-down and the User Data option before clicking Next.

You will then be asked for some basic information about your app. This information will not be shown to the public and it will be only for personal use. Fill in the following fields:

  • App name – enter an app name of your choice
  • User support email – select your email address from the choices provided
  • App logo – you can upload a logo for the app, but it is not required
  • Developer contact information – fill in your email address again

Click Save and Continue to proceed.

You can skip setting Scopes, so just click Save and Continue again.

On the next page select Web Application from the dropdown menu, which should make a new field Name appear. You can keep the default suggested name. Scroll down to Authorized Redirect URIs and click Add URI. In the field that appears input:

https://connect.wpmailsmtp.com/google/

and click Create.

Once your app has been created, the Your Credentials section will expand to show you your Client ID. There’s no need to copy it now, as you’ll access it from another area in a later step.

Your app will be created in Internal mode by default. In order to use it properly you need to set it to External and publish it. To do that, in your Google Cloud Console sidebar, go to APIs & Services > OAuth consent screen. Under User type, click on the MAKE EXTERNAL button. In the popup window that appears, select the In production option and click on CONFIRM.

Next, click on Credentials in the left-side menu. Under OAuth 2.0 Client IDs section you can see the details of the web application you just created. To view the Client ID and Client Secret, click the pencil icon and on the page that opens they will be on the right side.

Copy the values of the Client ID and Client Secret and paste them into the corresponding fields on the WP Mail SMTP plugin Settings page. Be careful not to copy any blank spaces as this will show an error on the next steps. Click Save Settings.

Once the page refreshes, scroll down and click the orange Allow plugin to send emails using your Google account button. This will ask you to sign in to your Google account and allow wpmailsmtp.com to access your Gmail email. Click Allow to proceed.

If you are connecting a free Gmail account, a notice may appear, explaining that Google hasn’t verified this app. Click Advanced, then Go to wpmailsmtp.com (unsafe) and then click Allow.

If you have done all of the above steps correctly you will be returned to the WordPress WPMail SMTP plugin’s Settings page and a notice saying “You have successfully linked the current site with your Google API project. Now you can start sending emails through Gmail.” will be present.

Always test the functionality of the mail-sending service after making changes to its settings. To do that go to your WordPress admin panel -> WP Mail SMTP -> Tools -> Email Test and send a test message to your email address. If you are not receiving the test message, then you need to verify the configuration settings you applied and ensure they are correct.

Tutorial Menu

Share This Article