> For the complete documentation index, see [llms.txt](https://madeindonesia.gitbook.io/mi-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://madeindonesia.gitbook.io/mi-guide/setup-project/setup-smtp.md).

# Setup SMTP

There are 2 kinds of SMTP setups that you guys have to follow (1) Setup for other Mail Providers and (2) Setup for Google Mail.

* ## <mark style="background-color:purple;">Other SMTP</mark>

The Other SMTP mailer allows you to send emails from any email address, using standard  SMTP (Simple Mail Transfer Protocol). As a result, it is easier to set up than most other mailers.\
\
You are more likely to run into server configuration issues when using this mailer. Also, you will have to update your mailer password settings if you change your email account’s password. These and other limitations can make for a less than ideal experience.

* **Cost:** There is no cost with the Other SMTP mailer.
* **From Email Requirements:** Can be used with any From Email address, but this address must be used site-wide.
* **Bottom Line:** Set up with the Other SMTP mailer is quick and easy, compared to most other options. It is useful for sites that cannot use other mailers, but it should not be the first choice, due to its security limitations.

Setting Up WP Mail SMTP\
Before you get started, be sure to [install and activate the WP Mail SMTP plugin](https://wpmailsmtp.com/docs/how-to-install-the-wp-mail-smtp-plugin/).\
Once you’ve installed the plugin, click on **WP Mail SMTP » Settings** in your WordPress sidebar menu. This will open the plugin’s Settings page.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2FB3ZaXG2J004CfF1pHvkf%2Fimage.png?alt=media\&token=32321391-f73b-4dd3-a739-c7d88df4e139)\ <br>

We’ll cover each of the available options in detail below.\
\
**From Email**\
\
This is the email address that all of your site’s emails will be sent from.\
\ <img src="https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2FhLVQTqklgoQaatHXsruA%2Fimage.png?alt=media&amp;token=bc8fc201-e843-4c5f-a082-eb2e4976f375" alt="" data-size="original">

{% hint style="warning" %}
**Note:** Make sure to enter the email address you will be using to send SMTP emails (this would be the email address associated with your Yahoo account, Gmail account, etc.).
{% endhint %}

I recommend that you also check the box labeled **Force From Email**. Doing so will ensure that the From Email setting within WP Mail SMTP matches the From Email settings for all plugins site-wide.\\

\ <img src="https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2Fv6BfHVPwBJS1eVAC8gpP%2Fimage.png?alt=media&amp;token=5fc68e50-115d-4a9a-95ac-5f99cea05a48" alt="" data-size="original">

\
**From Name**

By default, the From Name will be set to the name of your site. However, you can change this to anything you’d like.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2F5fEUozmLNCzUFSVzSxKi%2Fimage.png?alt=media\&token=14ffb9ae-2563-4352-9640-3477cfd6fc90)<br>

You can also choose to enable the **Force From Name** setting to apply this name to all emails site-wide.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2FeGVMo4Hjdz9OYmnw5yAK%2Fimage.png?alt=media\&token=94dcadf6-74a4-41e7-8717-75c6de59523c)

**Return Path**

I recommend checking the optional **Return Path** checkbox to **Set the return-path to match the From Email**. With this setting enabled, you’ll receive an email if any messages bounce due to issues with a recipient’s email.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2Fdr7x5c7AaRLss7qpNCSZ%2Fimage.png?alt=media\&token=95161b68-9501-4ca1-bc7d-a0c6e298310f)

**Mailer**

In the **Mailer** field, you’ll need to select the **Other SMTP** option.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2FOPSsmlp0GUorThMxmBVa%2Fimage.png?alt=media\&token=6d658731-9fc0-4274-a253-73693ec40365)

#### Configuring the Other SMTP Mailer <a href="#other-smtp" id="other-smtp"></a>

Once you’ve selected Other SMTP as your mailer, a new section will appear with additional SMTP settings for you to configure.

* **SMTP Host:** The outgoing server listed in your email provider’s SMTP settings.
* **Encryption:** The type of encryption used for the SMTP connection (TLS, SSL, or none).
* **SMTP Port:** The port your provider uses for SMTP connections.
* **Authentication:** Turns authentication on or off. Most providers require it to be on.
* **SMTP Username:** Your email address.
* **SMTP Password:** You’ll need to generate an app password for your account, as detailed later in this tutorial.

![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2Fnxt1ke2YfAl63DlvHxKh%2Fimage.png?alt=media\&token=89493fd1-03e0-4f8c-84e2-1d89df3abeeb)

Each email provider requires slightly different SMTP configurations. We’ve compiled a list of SMTP configurations for popular email providers below if you’re not sure what to enter for these settings.

{% hint style="info" %}
**Note:** For better security, we recommend adding your **SMTP Username** and **SMTP Password** to your site’s configuration file using constants. Check out our guide to [using constants for WP Mail SMTP](https://wpmailsmtp.com/docs/how-to-secure-smtp-settings-by-using-constants/) for details.
{% endhint %}

* ## <mark style="background-color:purple;">Google Workspace / Gmail</mark>

#### 1. Installing and Configuring the WP Mail SMTP Plugin <a href="#installation" id="installation"></a>

Before getting started, you’ll need to [install and activate the WP Mail SMTP plugin](https://wpmailsmtp.com/docs/how-to-install-the-wp-mail-smtp-plugin/).\
\
Once you’ve [verified your license](https://wpmailsmtp.com/docs/how-to-verify-your-wp-mail-smtp-license/), you’re ready to configure the plugin’s settings. You can find them by going to **WP Mail SMTP » Settings** and looking under the **General** tab.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2Fog80TLCFeQLkSclxfCYO%2Fimage.png?alt=media\&token=939fa274-6563-484d-b088-d1bdc537110f)

Below, we’ll cover the settings needed for this setup.\
\
**From Email**\
\
This is the email address that all of your site’s emails will be sent from. You can type your email address into the field provided or select the email address you’d like to use (including any [aliases you’ve configured](https://wpmailsmtp.com/gmail-send-from-alias-wp-mail-smtp/)) from the dropdown that appears after you connect your site to the Gmail API in later steps.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2FqQYRh15pkyDrvbVWOsjT%2Fimage.png?alt=media\&token=b7685882-e06e-45ca-b059-83dc1dc6535d)\
\
The **Force From Email** option will make it so all the emails sent from your site come from the address you’ve entered or selected.<br>

{% hint style="warning" %}
**Note:** In order to use multiple Gmail aliases throughout your WordPress site as the From Email address, make sure to leave the **Force From Email** box unchecked.
{% endhint %}

**From Name**\
\
Below the From Email, you can set the **From Name**. This is the name associated with the emails your site sends out. By default, it will be set to your site’s name, but you can adjust it to anything you’d like.\
\
You can also check the **Force From Name** option to apply this setting site-wide.\
\
![](https://115803331-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F705N8OeBYBxKGzhvaDVF%2Fuploads%2FA4j45VzfXYppoIqtoFeJ%2Fimage.png?alt=media\&token=34bf65ce-28f2-45a1-b1cd-aa20411cec3b)

**Mailer**\
\
This is where you can choose which mailer you’d like your site to use. Select the **Google / Gmail** option.\
\
\
![Selecting the Google / Gmail mailer in WP Mail SMTP's settings](https://wpmailsmtp.com/wp-content/uploads/2020/11/select-gmail-mailer.png)

Once you’ve chosen this mailer, you should see a new section appear titled **Google / Gmail**. In this section, there are settings labeled **Client ID** and **Client Secret**.

![The Google / Gmail mailer settings](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-gmail-mailer-settings.png)

To generate the information you need for these fields, you’ll need to use your Google account to create a web application. This process doesn’t require any coding, and we’ll show you exactly what to do in the next step.

You’ll be coming back to WP Mail SMTP’s settings page a little later, so for the next step, open a new tab or window in your browser.

#### 2. Creating a Web App in Your Google Account <a href="#create-app" id="create-app"></a>

In the new tab or window you’ve opened, log in to your Google account and open your [Google Cloud Console](https://console.cloud.google.com/home/dashboard).

{% hint style="info" %}
**Note:** Before continuing, be sure to sign out of all other Google accounts besides the account you’ll be using for the SMTP setup.\
\
Also, if you’re using Google Workspace, make sure that the Google account you use has permission to send emails (in other words, access to its own inbox).
{% endhint %}

If it’s your first time using Google Cloud Console, you may see a popup asking you to select your country and agree to the Terms of Service. Go ahead and do so, then click on **AGREE AND CONTINUE** to move on to the next step.

![Accepting the Google Cloud terms of service](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-terms-service.png)

If you’ve logged in to the Google Cloud Console before, you’ll likely bypass the Terms of Service.

**Creating or Choosing a Project**

First, you’ll need to choose a project to use for your app. You can select an existing one or create a new one.

To do so, click on the projects dropdown in the toolbar at the top of your dashboard.

![Opening the Google Cloud projects dropdown](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-projects-dropdown.png)

In the popup that appears, select an existing project from the list or click on **New Project** in the top right corner.

![Choosing to set up a new project for an app in Google Cloud](https://wpmailsmtp.com/wp-content/uploads/2022/11/create-new-project.png)

If you selected an existing project, move on to the next step. For a new project, enter a project name and select an organization and location from the dropdowns.

![Creating a new project in Google Cloud](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-create-new-project.png)

Then click on the **CREATE** button.

**Enabling the Gmail API**

Next, you need to enable the Gmail API for your project. In your Google Cloud Console sidebar, go to **APIs & Services » Library**.

![api services library](https://wpmailsmtp.com/wp-content/uploads/2022/11/api-services-library.png)

Then look under **Category** and click on **Google Workspace**, or enter “Gmail API” in the search bar.

![Opening the Workspace category in the Google API Library](https://wpmailsmtp.com/wp-content/uploads/2022/11/gmail-api.png)

Click on the **Gmail API** result.

![The Gmail API](https://wpmailsmtp.com/wp-content/uploads/2022/11/select-gmail-api.png)

On the Gmail API page, click on the blue **ENABLE** button.

![Enabling the Gmail API](https://wpmailsmtp.com/wp-content/uploads/2022/11/enable-gmail-api.png)

**Creating Your Application’s Credentials**

After you enable the Gmail API, you should be redirected to the Gmail API Overview page. Here, click on the **CREATE CREDENTIALS** button.

![Creating credentials for the Gmail API](https://wpmailsmtp.com/wp-content/uploads/2022/11/create-credentials.png)

On the next page, Google will ask a few questions to determine the Credential Type you need. From the **Select an API** dropdown, choose **Gmail API**.

![Select Gmail API](https://wpmailsmtp.com/wp-content/uploads/2021/10/select-gmail-api.png)

{% hint style="warning" %}
**Note:** If you don’t see an option for the Gmail API in the dropdown, be sure that you have the [Gmail API enabled](https://support.google.com/googleapi/answer/6158841?hl=en) for your account.
{% endhint %}

Next, under **What data will you be accessing?**, select the **User data** option. Then click the **NEXT** button to proceed.

![Click-next-button](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-next-button.png)

**Configuring Your OAuth Consent Screen**

Google will then ask for some basic information about your app.

This section is mostly for personal use since no one else will be using your app. However, some fields are still marked as required:

* **App name:** Enter an app name of your choice (e.g., Pattie’s App).
* **User support email:** Select your email address from the choices provided.
* **App logo:** If you’d like, you can upload a logo for your app. This is optional.

![Entering app information in Google Cloud](https://wpmailsmtp.com/wp-content/uploads/2021/10/app-information.png)

Finally, add your email address in the **Email addresses** field. Then click on the **SAVE AND CONTINUE** button to proceed to the next step.

![Click save and continue button](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-save-and-continue-button.png)

**Configuring Scopes (Optional)**

This is an optional step that we’ll be skipping for this tutorial. Scroll down to the end of the **Scopes** section and click on the **SAVE AND CONTINUE** button to proceed.

![Continuing past the Google Cloud scopes setup](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-save-and-continue-button-scopes-section.png)

**Note:** For more information on Gmail API scopes, please see Google’s [developer documentation](https://developers.google.com/gmail/api/auth/scopes).

**Setting Up Your OAuth Client ID**

Next, you’ll need to fill out some information about your OAuth Client ID.

From the **Application type** dropdown, select the **Web application** option. Once you do so, more fields will automatically populate.

![Select web application](https://wpmailsmtp.com/wp-content/uploads/2021/10/select-web-application.png)

You can leave the **Name** field as the default value or change it to something more relevant. For this example, we’ll keep the default name, **Web client 1**.

![OAuth name](https://wpmailsmtp.com/wp-content/uploads/2021/10/OAuth-name.png)

Next, skip the **Authorized JavaScript origins** section and scroll to **Authorized redirect URIs**.

Click on the **+ ADD URI** button and input the following: `https://connect.wpmailsmtp.com/google/`. You can also copy this value from your WP Mail SMTP settings and paste it here if you prefer.

![Input for URI](https://wpmailsmtp.com/wp-content/uploads/2021/10/input-for-uri.png)

Then click on the **CREATE** button to complete this step.

![Click create button](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-create-button.png)

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.

Instead, go ahead and click the **DONE** button at the bottom of the page.

![Click done button](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-done-button.png)

#### 3. Updating the Publishing Status From Testing to Production <a href="#from-testing-to-production" id="from-testing-to-production"></a>

Google will put your app into Internal mode by default. It’s really important that you switch it to External mode and publish it. Otherwise, your app will be super limited and won’t function properly.

In your Google Cloud Console sidebar, go to **APIs & Services » OAuth consent screen**. Under **User type**, click on the **MAKE EXTERNAL** button.

![Clicking the MAKE EXTERNAL button to change the publishing status of a Google Cloud app](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-app-make-external.png)

{% hint style="warning" %}
**Note:** Only users within your organization can access your app if the **User type** is set to **Internal**. For example, if your Workspace domain is **example.com**, users can only access your app using an **@example.com** email address.
{% endhint %}

External email addresses will see an error that reads `Error 403: org_internal` when granting WP Mail SMTP access to your app.

In the popup window that appears, select the **In production** option. Then click on **CONFIRM**.

![Setting the Google Cloud app publishing status to In production](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-app-in-production.png)

Once confirmation is complete, you’ll see that your app’s Publishing status is now **In production**.

![Checking the publishing status of a Google Cloud app](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-cloud-app-publishing-status.png)

#### 4. Granting Your Site Google / Gmail Permissions <a href="#permissions" id="permissions"></a>

Next, click on **Credentials** in the left side menu.

![api credentials page](https://wpmailsmtp.com/wp-content/uploads/2022/11/api-credentials.png)

Once you’re on the Credentials page, in the **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.

![Click pencil icon](https://wpmailsmtp.com/wp-content/uploads/2021/10/click-pencil-icon.png)

This will open all of the details for your app. On the right side of this page, you’ll see the **Client ID** and **Client secret** values.

![Client ID and client secret](https://wpmailsmtp.com/wp-content/uploads/2021/10/Client-ID-and-Client-Secret.png)

Go ahead and copy both of these values into the corresponding fields in your WP Mail SMTP settings.

![Pasting your Client ID and Client Secret in the Google / Gmail mailer settings](https://wpmailsmtp.com/wp-content/uploads/2020/11/google-gmail-add-client-id-secret.png)

{% hint style="warning" %}
**Note:** Be very careful not to copy any extra text or spaces with your Client ID or Client Secret, as this will result in an error in the next step.
{% endhint %}

Once you’ve added these values, click the **Save Settings** button at the bottom of the page.

![Save settings button](https://wpmailsmtp.com/wp-content/uploads/2021/10/save-settings-button.png)

After saving your settings, the page will refresh. You must grant permission before Google allows our plugin to use your Gmail API to send emails.

To do this, scroll to the bottom of the WP Mail SMTP settings page and click the button labeled **Allow plugin to send emails using your Google account**.

![Authorize plugin to send emails with Gmail](https://wpmailsmtp.com/wp-content/uploads/2020/09/Authorize-plugin-to-send-emails-with-Gmail.png)

This will open a login screen for Google. Go ahead and log in to the account you’re setting up SMTP with.

Next, you’ll see a screen asking for permission for this site to send emails on your behalf.

When you’re ready, click the **Allow** button to proceed.

![Allowing your site to send emails from your Google account](https://wpmailsmtp.com/wp-content/uploads/2020/11/allow-google-permissions.png)

**Bypassing Google’s Verification Warning (Free Gmail Users Only)**

You might see the following screen if you are connecting with a free Gmail account. Go ahead and click on the **Advanced** link in the bottom left corner.

![Gmail OAuth warning](https://wpmailsmtp.com/wp-content/uploads/2021/10/gmail-oauth-warning.png)

In the expanded section, click on **Go to wpmailsmtp.com (unsafe)**. Don’t worry, Google only displays this warning because it hasn’t verified your app. There is no need to verify it since you created this app just for your own use.

![Gmail OAuth show advanced](https://wpmailsmtp.com/wp-content/uploads/2021/10/gmail-oauth-show-advance.png)

Then click on the **Allow** button as shown above.

#### 5. Sending a Test Email <a href="#test-email" id="test-email"></a>

Next, you’ll be returned to your WP Mail SMTP settings and a success message will be displayed. Once the connection is complete, you’re ready to send a test email. To do so, navigate to **WP Mail SMTP » Tools** and open up the **Email Test** tab.

![Email Test tab in WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2021/08/Email-test-tab-in-WP-Mail-SMTP.png)

Once the **Email Test** tab is open, you’ll need to enter an email address whose inbox you have access to. Unless you’re sure you’ll only send plain text emails from your site, we recommend leaving the **HTML** setting **ON**. Then click the **Send Email** button.

![Click send email button](https://wpmailsmtp.com/wp-content/uploads/2021/08/Click-send-email-button.png)

You’ll see a success message when the test email has been sent.

![WP Mail SMTP test email success message](https://wpmailsmtp.com/wp-content/uploads/2021/08/WP-Mail-SMTP-test-email-success-message.png)

You should also soon receive the test email at the email address you entered.

![Successful test email from WP Mail SMTP](https://wpmailsmtp.com/wp-content/uploads/2021/08/Successful-test-email-from-WP-Mail-SMTP.png)

<br>
