PHPackages                             synio/laravel-gmail-service-account-mail-driver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. synio/laravel-gmail-service-account-mail-driver

ActiveLibrary

synio/laravel-gmail-service-account-mail-driver
===============================================

Use GMail API to send mails from any user/mailbox of your Workspace organization using a service account without needing separate mailbox credentials

0.2.0(3y ago)521.1k↓11.1%2[1 issues](https://github.com/synio-wesley/laravel-gmail-service-account-mail-driver/issues)MITPHPPHP ^8.0

Since Sep 2Pushed 2y ago1 watchersCompare

[ Source](https://github.com/synio-wesley/laravel-gmail-service-account-mail-driver)[ Packagist](https://packagist.org/packages/synio/laravel-gmail-service-account-mail-driver)[ Docs](https://github.com/synio/laravel-gmail-service-account-mail-driver)[ RSS](/packages/synio-laravel-gmail-service-account-mail-driver/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

Use GMail API to send mails from any user/mailbox of your Workspace organization using a service account without needing separate mailbox credentials
=====================================================================================================================================================

[](#use-gmail-api-to-send-mails-from-any-usermailbox-of-your-workspace-organization-using-a-service-account-without-needing-separate-mailbox-credentials)

[![Latest Version on Packagist](https://camo.githubusercontent.com/56195f3d3cf23c0c0ba4d495ce2cd64cf4d8c22df22ff927a826656b1b1c1adf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73796e696f2f6c61726176656c2d676d61696c2d736572766963652d6163636f756e742d6d61696c2d6472697665722e7376673f7374796c653d666c6174)](https://packagist.org/packages/synio/laravel-gmail-service-account-mail-driver)[![GitHub Tests Action Status](https://camo.githubusercontent.com/9a6f69af17fc782422aa2a6b7d56424b1e526b4633f9c691df0a19336dce4709/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73796e696f2d7765736c65792f6c61726176656c2d676d61696c2d736572766963652d6163636f756e742d6d61696c2d6472697665722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c6174)](https://github.com/synio-wesley/laravel-gmail-service-account-mail-driver/actions?query=workflow%3Arun-tests+branch%3Amain)[![License](https://camo.githubusercontent.com/3ccf9010d08e84ba9dc6bbb1956c4f3c5ff83a7d3d31dfaeaf79a8e04d6f11b9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73796e696f2d7765736c65792f6c61726176656c2d676d61696c2d736572766963652d6163636f756e742d6d61696c2d6472697665722e7376673f7374796c653d666c6174)](https://github.com/synio-wesley/laravel-gmail-service-account-mail-driver/blob/main/LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/75ba39b00095c35cab2f0ffddda09e51dfb6f493ac1bce92dffd027e941ed28a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796e696f2f6c61726176656c2d676d61696c2d736572766963652d6163636f756e742d6d61696c2d6472697665722e7376673f7374796c653d666c6174)](https://packagist.org/packages/synio/laravel-gmail-service-account-mail-driver)

This Laravel package adds a mail driver for the GMail API using a service account. This makes it possible to send mails using the actual mailbox of any user/mailbox in your Google Workspace, without requiring additional App Passwords or other workarounds.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require synio/laravel-gmail-service-account-mail-driver
```

### Setup at Google

[](#setup-at-google)

*I initially used [this guide](https://ebstalimited.zendesk.com/hc/en-us/articles/360017031473-How-to-a-create-a-Gmail-service-account) with screenshots to perform these operations. It might help you out better.*

Before you can use this package, you need to configure the following in Google Cloud Platform Console:

- Enable GMail API for a project
- Create service account user
- Create JSON type key for this service account user
- Download and save the generated JSON file
- Write down the `client_id` (or take it from inside the JSON file)

And then you have to configure 'Domain wide delegation' in Google Workspace Admin:

- Go to *Security -&gt; API controls -&gt; Domain wide delegation -&gt; Manage domain wide delegation*
- Add new API client
    - Input the Client ID you wrote down
    - Input the following OAuth scope: `https://www.googleapis.com/auth/gmail.send`
    - Confirm by clicking on *Authorize*

### Setup in your app

[](#setup-in-your-app)

After you downloaded a JSON type key file, you should put the JSON file somewhere and you should let the package know the path in one of the following ways:

- Define `GMAIL_SERVICE_ACCOUNT_GOOGLE_APPLICATION_CREDENTIALS` in your `.env` file. The value should be a filename relative to the root directory of your app, or an absolute path
- Alternatively, you can also update your `services.php` config file, and add something like this:

    ```
        'gmail_service_account' => [
            'google_application_credentials' => '/path-to-json-file',
        ],
    ```

You also have to add the mailer configuration to your `mail.php` config file:

```
    'mailers' => [
        // ...Existing mailers here...

        'gmail-service-account' => [
            'transport' => 'gmail-service-account',
        ],
    ],
```

Usage
-----

[](#usage)

To enable this mail driver globally by default, you can set `MAIL_MAILER` to `gmail-service-account` in your `.env` file.

Any mails sent using the `gmail-service-account` driver using the Laravel framework (`Mail` facade or `Mailables` for example) will now be sent using the configured GMail service account.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Wesley Stessens](https://github.com/synio-wesley)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

1353d ago

PHP version history (2 changes)0.1.0PHP ^8.1

0.1.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/872e20d1d0b650d30d43532813f4108514bea96bbc754b5bed06a7ba16a6ca84?d=identicon)[synio](/maintainers/synio)

---

Top Contributors

[![synio-wesley](https://avatars.githubusercontent.com/u/30413?v=4)](https://github.com/synio-wesley "synio-wesley (19 commits)")

---

Tags

laravelSyniolaravel-gmail-service-account-mail-driver

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/synio-laravel-gmail-service-account-mail-driver/health.svg)

```
[![Health](https://phpackages.com/badges/synio-laravel-gmail-service-account-mail-driver/health.svg)](https://phpackages.com/packages/synio-laravel-gmail-service-account-mail-driver)
```

###  Alternatives

[badaso/core

The API &amp; platform builder, build your apps 10x faster even more, it's open source &amp; 100% free !

1.3k16.2k10](/packages/badaso-core)[schulzefelix/laravel-search-console

A Laravel package to retrieve data from Google Search Console

5037.8k1](/packages/schulzefelix-laravel-search-console)[sahusoftcom/youtube-livestream-api

PHP (Laravel) Package for Google / YouTube API of Video Live Streaming with Google Auth

451.1k](/packages/sahusoftcom-youtube-livestream-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
