I have been using the WP Mail STMP WordPress plugin to send email from WordPress using either a STMP relay service and more recently Office 365.  However, I was curious if you could use something for free.  I went to research and noticed the plugin had an option for Gmail.  I found an article that explained how to configure.

Here are the steps I did:

  • Register in Gmail
    • https://www.google.com/accounts/Logout?continue=https://console.developers.google.com/start/api?id=gmail
    • Click Yes and click Agree and continue
    • Click “Go to credentials”
    • Credentials
      • Which API are you using – Gmail API
      • Where will you be calling the API from – Web server
      • What data will you be accessing – User data
      • Click “What credentials do I need”
    • OAuth 2.0 client ID
      • Name – name
      • Authorized JavaScript origins
        • http://domainname.com/
      • Authorized redirect URIs
        • Copy from plugin settings page
          • http://domainname.com/wp-admin/options-general.php?page=wp-mail-smtp&tab=auth
      • Click “Create client ID”
      • Product Name – name
      • Click Continue
      • Click “I’ll do this later”
      • Edit to see entire I
  • Copy Client ID and Client secret into WordPress plugin
    • Save and page will refresh
    • Click “Allow plugin to send emails using your Google account”
      • Enter Gmail address and password
      • If app isn’t verified, go to advanced
      • Allow
  • Confirm in plugin that everything was successfully linked
    • Test email in plugin

Reference:

https://wpforms.com/how-to-securely-send-wordpress-emails-using-gmail-smtp/