milind/laravel-gmail-mail-driver
最新稳定版本:0.2
Composer 安装命令:
composer require milind/laravel-gmail-mail-driver
包简介
This package is used to provide gmail mail driver for the laravel
README 文档
README
This package is used to provide gmail email service provider for the email driver in laravel.
This is simple wrapper so you need to manage authentication and app approval process on your end and also need to manage refreshing the access token process on your end as well.
Add new mailers driver in config/mail.php as below
'gmail' =>[
'transport' => 'gmail'
]
Add new gmailmailer service in config/services.php as below
'gmailmailer' => [
'AppName' => 'Your-app-name',
'scopes' => [
/* We need both the scopes for the API to send the email */
Google_Service_Gmail::GMAIL_READONLY, // This scope is used to get the user's email address (From which we are sending emails)
Google_Service_Gmail::GMAIL_SEND // This scope is used to send the emails.
],
'authConfig' => [
/*
* We are getting this details from the Google console.
*
*/
"web" => [
"client_id" => env('GOOGLE_EMAIL_SEND_API_CLIENT_ID'),
"client_secret" => env('GOOGLE_EMAIL_SEND_API_CLIENT_SECRET'),
"redirect_uris" => [
env('GOOGLE_EMAIL_SEND_API_REDIRECT')
],
]
],
'tokenType' => 'offline',
'prompt' => 'select_account consent',
]
You also need to add accesstoken recevied from the google account to the gmailmailer dynamically / Manually
I personally prefer dynamically
You need to add it as array
Config::set('services.gmailmailer.accesstoken', $accessToken);
Where $accessToken will be as follows
$accessToken = [
"access_token" => "...",
"expires_in" => ...,
"refresh_token" => "...",
"scope" => "...",
"token_type" => "...",
"created" => ...
];
统计信息
- 总下载量: 5.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-16