当前位置:网站首页>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
边栏推荐
- The iswow64process function determines the number of program bits
- MySQL数据库常识之储存引擎
- Leetcode 232, queue with stack
- JSX syntax rules
- Rt-1052 learning notes - GPIO architecture analysis
- C migration project record: modify namespace and folder name
- [PTA] l1-002 printing hourglass
- XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
- 上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
- Unity Odin ProgressBar add value column
猜你喜欢

Fastdfs思维导图

2021-09-02 unity project uses rider to build hot change project failure record of ilruntime

MySQL基础合集

C migration project record: modify namespace and folder name

Go language development Daily Fresh Project Day 3 Case - Press Release System II

Latex formula

缓存淘汰算法初步认识(LRU和LFU)

Resolve the error - error identifier 'attr_ id‘ is not in camel case camelcase

Scrapy教程 - (2)寫一個簡單爬蟲

Unity animation creates sequence frame code and generates animationclip
随机推荐
Syntaxerror: unexpected token r in JSON at position 0
Unity Odin ProgressBar add value column
Leetcode 542, 01 matrix
Matlab: psychtoolbox installation
The iswow64process function determines the number of program bits
堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
The ODB model calculates the data and outputs it to excel
GSI-ECM工程建设管理数字化平台
Leetcode 709, convert to lowercase
Parsing methods of JSON data in C - jar and jobobject: error reading jar from jsonreader Current JsonReader item
[PTA] l1-006 continuity factor
Recognition of high-speed road signs by Matlab using alexnet
[SQL] string series 2: split a string into multiple lines according to specific characters
LeetCode 709、转换成小写字母
MySQL进阶之数据的增删改查(DML)
Vscode download speed up
三十一. `prototype`显示原型属性和`__proto__`隐式原型属性
Psychological formula for converting RGB to gray value
Introduction to intrusion detection data set
Elastic box model