Take your e-commerce store further.

Using the right Magento 2 extension is more essential now than ever. With MagePal, you can rest assured that you are getting the best quality Magento extensions, each line of code are carefully crafted and rigorously tested. Spend less time debugging and more time doing what you do best with MagePal extensions!

Google Gmail OAuth SMTP Extension for Magento 2

With Google deprecating less secure apps and basic password authentication, integrating OAuth 2.0 authentication is essential for sending transactional emails reliably.

In this guide, you will learn how to activate OAuth 2.0 authentication in your Google Cloud Console and authenticate your Magento 2 store with Gmail or Google Workspace (formerly G Suite). Using token-based authorization ensures high email deliverability, protects account credentials, and keeps your customer communications secure.

What is OAuth 2.0 for SMTP?

OAuth 2.0 (Open Authorization) is an industry-standard security protocol that allows Magento to send emails through your Gmail or Google Workspace account without storing your account password. Instead, Magento authenticates securely using access tokens granted via Google Cloud APIs.

Installation Guide

Step 1 - Install Extension

  • Please log in to your MagePal account for access credentials to our private composer repository.
composer require magepal/magento2-smtp-google-oauth
Important: Extension Compatibility Notice

Due to underlying email framework updates across Magento versions (Zend Framework -> Laminas -> Symfony Mailer), ensure you select the appropriate extension version:

  • Magento 2.4.5 and earlier: Use SMTP Google OAuth 3.0.x
  • Magento 2.4.6 – 2.4.7: Use SMTP Google OAuth 3.5.x
  • Magento 2.4.8 and later: Use SMTP Google OAuth 4.0.x

  • Download the extension archive from your MagePal account.
  • Unzip the archive.
  • Create the target directory: {Magento 2 root}/app/code/MagePal/SmtpGoogleOauth
  • Copy the contents from the unzipped folder into this directory.

Step 2 - Enable Module

Run the following commands from your Magento root directory:

php -f bin/magento module:enable --clear-static-content MagePal_SmtpGoogleOauth
php -f bin/magento setup:upgrade

Magento 2 SMTP Configuration Settings

Step 3 - Configure Magento SMTP Settings

  1. Log into your Magento 2 Admin Panel.
  2. Navigate to Stores > Configuration.
  3. Under the MagePal tab, select SMTP Configuration.
  4. Set Authentication Method to Google OAuth2 and enter your Client ID and Client Secret.

Step 4 - Extension Review

Like our extensions? Would you be kind enough to leave us a Google review? It only takes a minute and we’d be eternally grateful! Just click the link to go to our MagePal Google Business page and leave us your feedback.

Supported SMTP Providers

Integrate Magento 2 with Google OAuth SMTP providers quickly and easily:

  • Gmail Personal Accounts (@gmail.com)
  • Google Workspace / G Suite Custom Domains
  • Google Cloud Service Accounts

How to Update to the Latest Version

Step 1 - Update Package

composer update magepal/magento2-smtp-google-oauth
Manually
  • Download the latest version from your MagePal account.
  • Extract and overwrite files in {Magento 2 root}/app/code/MagePal/SmtpGoogleOauth.

Step 2 - Run Setup Upgrade

php -f bin/magento setup:upgrade

Configuring OAuth2 in your Google Account

  1. Log into your Google Account and visit the Google Cloud Console Project Creator. Enter a project name and click Create. Creating a new project in Google Cloud Console
  2. Enable Gmail API access using the Gmail API Activation Link. Enabling Gmail API in Google Cloud Console
    Click Next to confirm the project, then click Enable on the following screen.
  3. From the left-hand navigation menu, select APIs & Services > Credentials. Navigating to APIs and Services Credentials
  4. Click Create Credentials at the top of the screen. Creating API Credentials
  5. Select Help me choose from the dropdown menu. Selecting Help Me Choose
  6. Under Which API are you using? select Gmail API and choose the User data option. Follow the remaining prompts to generate your Client ID and Client Secret. Selecting Gmail API and User Data Credentials

Version History | Change Log

4.0.0

  • New Features:
    • Add support for Magento 2.4.8 and PHP 8.4

3.5.1

  • New Features:
    • Improve email testing logic and reliability
    • Generate new refresh token

3.0.1

  • New Features:
    • Improve email testing logic and reliability

Related Extensions

Get more from your Magento2 store!

Catalog Hover Image for Magento

Quickly previewing alternative product images on your category list page.

Enhanced Transactional Emails

Get more from your order confirmation emails by promoting other complementary products.

Order Shipment Tracking

Providing your customer with a beautiful and functional order package tracking without leaving your site.

0

Total Downloads

11

years experience with Magento

30+

Magento / Adobe Commerce Extensions

Shop with confidence

With millions of downloads worldwide, install with confidence knowing that our extensions will just work.

Prepare for the future with Google Analytics 4

Is your Magento store ready for the future? Say hello to the new Google Analytics 4, which is built from the ground up with all-new features and advanced machine learning technology.

Learn More