https://github.com/overtrue/laravel-mail-aliyun
:e-mail: Aliyun DrirectMail Transport for Laravel Application.
https://github.com/overtrue/laravel-mail-aliyun
aliyun aliyun-mail directmail laravel-mail mail
Last synced: 11 months ago
JSON representation
:e-mail: Aliyun DrirectMail Transport for Laravel Application.
- Host: GitHub
- URL: https://github.com/overtrue/laravel-mail-aliyun
- Owner: overtrue
- Created: 2018-07-17T15:36:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-08T21:19:08.000Z (almost 2 years ago)
- Last Synced: 2025-03-28T13:09:21.396Z (over 1 year ago)
- Topics: aliyun, aliyun-mail, directmail, laravel-mail, mail
- Language: PHP
- Homepage:
- Size: 43 KB
- Stars: 70
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
Laravel mail aliyun
:e-mail: Aliyun DrirectMail Transport for Laravel Application.
[](https://github.com/sponsors/overtrue)
## Installing
```shell
$ composer require overtrue/laravel-mail-aliyun -vvv
```
## Configuration
> API documention: https://help.aliyun.com/document_detail/29435.html
*config/services.php*
```php
'directmail' => [
'key' => env('ALIYUN_ACCESS_KEY_ID'),
'secret' => env('ALIYUN_ACCESS_KEY_SECRET'),
'region_id' => env('ALIYUN_REGION_ID'),
'from_address' => env('ALIYUN_FROM_ADDRESS'),
'from_alias' => env('ALIYUN_FROM_ALIAS'),
],
```
AccessKeyID 和 AccessKeySecret 由阿里云官方颁发给用户的 AccessKey 信息(可以通过阿里云控制台[用户信息管理](https://usercenter.console.aliyun.com/?spm=a2c4g.11186623.2.17.12f2461dHSyXbw#/manage/ak)中查看和管理).
## Usage
Set default mail driver and configuration:
*.env*
```bash
MAIL_DRIVER=directmail
ALIYUN_ACCESS_KEY_ID= #AccessKeyID
ALIYUN_ACCESS_KEY_SECRET= #AccessKeySecret
ALIYUN_REGION_ID= #RegionID: cn-hangzhou, ap-southeast-1, ap-southeast-2
ALIYUN_FROM_ADDRESS= #FromAddress
ALIYUN_FROM_ALIAS= #FromAlias
```
*TagName*
```php
use Overtrue\LaravelMailAliyun\HasTagName;
class VerifyMail extend Mailable{
use HasTagName;
public function build()
{
$this->tagName('alreadyDefinedTag');
return $this->text('mails.verify');
}
}
```
Please reference the official doc: [Laravel Sending mail](https://laravel.com/docs/5.6/mail#sending-mail)
## :heart: Sponsor me
[](https://github.com/sponsors/overtrue)
如果你喜欢我的项目并想支持它,[点击这里 :heart:](https://github.com/sponsors/overtrue)
## Project supported by JetBrains
Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.
[](https://www.jetbrains.com/?from=https://github.com/overtrue)
## PHP 扩展包开发
> 想知道如何从零开始构建 PHP 扩展包?
>
> 请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)
## License
MIT