定制 pioneeringtechlab/laravel-gmail-oauth-mailer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pioneeringtechlab/laravel-gmail-oauth-mailer

Composer 安装命令:

composer require pioneeringtechlab/laravel-gmail-oauth-mailer

包简介

Gmail OAuth2 SMTP mail transport for Laravel 10, 11, and 12 using Symfony Mailer.

README 文档

README

Gmail OAuth2 SMTP XOAUTH2 mail transport for Laravel 10, 11, and 12 using Symfony Mailer.

Installation

Run the following command on your Laravel project root directory:

composer require pioneeringtechlab/laravel-gmail-oauth-mailer:^1.0

Publish config

php artisan vendor:publish --tag=gmail-oauth-mailer-config

Configure Laravel mailer

In config/mail.php, add a mailer:

'mailers' => [
    // ...

    'gmail-oauth' => [
        'transport' => 'gmail-oauth',
    ],
],

Environment variables

MAIL_MAILER=gmail-oauth
MAIL_FROM_ADDRESS=youraddress@gmail.com
MAIL_FROM_NAME="${APP_NAME}"

GMAIL_OAUTH_EMAIL=youraddress@gmail.com
GMAIL_OAUTH_CLIENT_ID=your-google-client-id
GMAIL_OAUTH_CLIENT_SECRET=your-google-client-secret
GMAIL_OAUTH_REFRESH_TOKEN=your-refresh-token

GMAIL_OAUTH_SCOPE=https://mail.google.com/
GMAIL_OAUTH_HOST=smtp.gmail.com
GMAIL_OAUTH_PORT=587
GMAIL_OAUTH_ENCRYPTION=tls

After editing env/config values:

php artisan config:clear

Notes

  • For Gmail SMTP OAuth2, the usual scope is https://mail.google.com/.
  • Port 587 normally uses GMAIL_OAUTH_ENCRYPTION=tls.
  • Port 465 normally uses GMAIL_OAUTH_ENCRYPTION=ssl.
  • This package refreshes the access token when Laravel creates the mail transport. It does not cache the access token.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固