当前位置:网站首页>laravel 发送邮件
laravel 发送邮件
2022-04-23 20:43:00 【陈卿诺语】
laravel 邮件发送核心要点:需要用到Mail对象
1、首先要在邮箱中配置:开启 【POP3/SMTP服务】
生成密钥
2、在 .env 中配置
MAIL_MAILER=smtp
MAIL_HOST=smtp.qq.com
MAIL_PORT=465
[email protected]//你的发送邮件账号
MAIL_PASSWORD=//开启qq邮箱SMTP后获取的授权密码
MAIL_ENCRYPTION=ssl
[email protected]//你的发送邮件账号
MAIL_FROM_NAME="${APP_NAME}"
3、在控制器中操作:引入Mail对象
use Illuminate\Support\Facades\Mail;
4、添加邮件发送方法:
//直接文本发送
Mail::raw('测试邮件',function ($message){
$message->from('[email protected]//你的发送邮件账号','测试邮件');
$message->subject('hhhhhhhh');
$message->to('[email protected]//你的发送邮件账号');
});
$qq = '[email protected]//你的发送邮件账号';
//使用blade模板发送(引用的模板)
Mail::send('mailtest',['name' => 'test'],function($message)use($qq){
$message->to($qq)->subject('hhhhhhh');
});
5、如果使用blade模板发送,需要添加对应的blade模板,如上例就是在/view目录下添加mailtest.blade.php模板
<p>hello {
{$name}}</p>
版权声明
本文为[陈卿诺语]所创,转载请带上原文链接,感谢
https://blog.csdn.net/code_nutter/article/details/124356589
边栏推荐
- Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
- 内网渗透之DOS命令
- LeetCode 232、用栈实现队列
- Introduction to standardization, regularization and normalization
- GO語言開發天天生鮮項目第三天 案例-新聞發布系統二
- [matlab 2016 use mex command to find editor visual studio 2019]
- Leetcode 542, 01 matrix
- Vscode download speed up
- Commande dos pour la pénétration de l'Intranet
- Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
猜你喜欢
Three. Based on ply format point cloud voxel model JS upload interface writing
LeetCode 116. Populate the next right node pointer for each node
Devexpress 14.1 installation record
2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
Summary and effect analysis of methods for calculating binocular parallax
2021-09-02 unity project uses rider to build hot change project failure record of ilruntime
Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
[matlab 2016 use mex command to find editor visual studio 2019]
Preliminary understanding of cache elimination algorithm (LRU and LFU)
"Meta function" of tidb 6.0: what is placement rules in SQL?
随机推荐
Leetcode 232, queue with stack
The iswow64process function determines the number of program bits
启牛学堂有用吗,推荐的证券账户是否安全
MySQL stored procedures and functions
Go language development Daily Fresh Project Day 3 Case - Press Release System II
【PTA】L2-011 玩转二叉树
Tensorflow 2 basic operation dictionary
Preliminary understanding of cache elimination algorithm (LRU and LFU)
Latest investigation and progress of building intelligence based on sati
Modeling based on catiav6
bounding box iou
GSI-ECM工程建设管理数字化平台
Leetcode 1346. Check whether integers and their multiples exist
go slice
Automatically fill in body temperature and win10 task plan
Learn to C language fourth day
Easy to use nprogress progress bar
An error occurs when the addressable assets system project is packaged. Runtimedata is null
Unity asset import settings
The problem of 1 pixel border on the mobile terminal