Skip to content
HostingSquad
To websitehostingsquad.nl
Search
EN

How do I send email from my WordPress website with Gmail?

Updated on

If you use Gmail, you can have the email from your WordPress website sent through your Gmail account. This way, completed contact forms and security notifications arrive more reliably. You do this with the free WP Mail SMTP plugin and your own app in the Google Cloud Console. If you do not use Gmail, see How do I send email from my WordPress website with Easy WP SMTP?

Before you start

  • You are logged in to WordPress; see How do I log in to WordPress from DirectAdmin?
  • In your browser, you are logged in only to the Google account you want to send from. Log out of other Google accounts.
  • The names in WordPress are those of WordPress in English. If your WordPress is in Dutch, they are Plugins › Plugin toevoegen, Nu installeren, Activeren, Instellingen, E-mailadres afzender, Naam afzender, Client-ID, Geheime sleutel van de client, Instellingen opslaan, Sta de plugin toe e-mails te verzenden met het Google-account, Tools, E-mailtest and Verstuur e-mail.
  • The names in the Google Cloud Console and on the screens of your Google account are those from the WP Mail SMTP guide. The screens of your Google account may show them in Dutch.

Install the plugin

  1. Open Plugins › Add Plugin

    In the menu on the left, click Plugins and then Add Plugin.

  2. Find the plugin

    Type WP Mail SMTP in the Search Plugins field.

  3. Install the plugin

    For WP Mail SMTP, click Install Now.

  4. Activate the plugin

    Click Activate.

Create an app in the Google Cloud Console

  1. Open the Google Cloud Console

    Go to the Google Cloud Console. If you are using it for the first time, accept the terms.

  2. Create a project

    Open the project picker in the bar at the top and click New project. Give the project a name and click CREATE.

  3. Enable the Gmail API

    In the menu, go to APIs & Services › Library. Search for Gmail API, open the result and click Enable.

  4. Click Create credentials

    On the Gmail API page, click Create credentials. At Select an API, choose the Gmail API, choose User data and click NEXT.

  5. Enter the app details

    Enter a name for the app, your email address at User support email and your email address at Email addresses. Click SAVE AND CONTINUE. Skip the Scopes step with SAVE AND CONTINUE.

  6. Create the OAuth client

    At Application type, choose Web application. Under Authorized redirect URIs, click + ADD URI and enter https://connect.wpmailsmtp.com/google/. Click Create and then Done.

  7. Publish the app

    Go to APIs & Services › OAuth consent screen and open the Audience tab. At Publishing status, click PUBLISH APP and then CONFIRM. If you use Google Workspace, click MAKE EXTERNAL at User type, choose In production and click Confirm.

  8. Copy the Client ID and the secret

    Go to APIs & Services › Credentials and, under OAuth 2.0 Client IDs, click the pencil. Copy the Client ID. Under Client secrets, click + Add secret and copy the new secret, without spaces before or after it.

Connect WP Mail SMTP to Gmail

  1. Open WP Mail SMTP › Settings

    In WordPress, in the menu on the left, click WP Mail SMTP and then Settings.

  2. Enter the sender

    At From Email and From Name, enter the address and the name your website sends email from.

  3. Choose Google / Gmail

    At Mailer, choose Google / Gmail.

  4. Paste the Client ID and the secret

    Paste the Client ID at Client ID and the secret at Client Secret.

  5. Save the settings

    Click Save Settings.

  6. Connect your Google account

    At the bottom, click Allow plugin to send emails using your Google account, log in to Google and click Allow. If Google says the app has not been verified, click Advanced, then Go to wpmailsmtp.com (unsafe) and then Allow. That is safe here: you created the app yourself.

Any questions? Contact us (in Dutch).

Related articles