当前位置:网站首页>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
边栏推荐
- Devexpress 14.1 installation record
- go struct
- Matlab matrix index problem
- On BIM data redundancy theory
- GO语言开发天天生鲜项目第三天 案例-新闻发布系统二
- Common form verification
- Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
- SQL: query duplicate data and delete duplicate data
- GSI-ECM工程建设管理数字化平台
- go slice
猜你喜欢

MySQL基础之写表(创建表)

Vulnhub DC: 1 penetration notes

居家第二十三天的午饭

Imitation Baidu map realizes the three buttons to switch the map mode by automatically shrinking the bottom

DOS command of Intranet penetration

BMP JPEG picture to vector image contourtrace

2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real

Three. Based on ply format point cloud voxel model JS upload interface writing

Leetcode 74. Search two-dimensional matrix

RT-1052学习笔记 - GPIO架构分析
随机推荐
On IRP from the perspective of source code
LeetCode 1346、检查整数及其两倍数是否存在
Case of the third day of go language development fresh every day project - news release system II
2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
MySQL基础合集
How can matlab obtain the truncated image in trainingimagelabeler
Latest investigation and progress of building intelligence based on sati
MySQL数据库常识之储存引擎
內網滲透之DOS命令
Automatically fill in body temperature and win10 task plan
LeetCode 709、转换成小写字母
Syntaxerror: unexpected token r in JSON at position 0
Monte Carlo py solves the area problem! (save pupils Series)
Thirty What are VM and VC?
Modeling based on catiav6
Devaxpress report replay: complete the drawing of conventional two-dimensional report + histogram + pie chart
【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
Implementation of mypromise
Create vs project with MATLAB
C migration project record: modify namespace and folder name