我欲乘风九万里
梦的起点
心灵之声
珊瑚礁
编码之舞
梦中的微风
项目编码
聚合登录文档
建议
AI助手
php发送邮件
一、首先安装对应的mail包 ```php composer require symfony/mailer ``` 二、发送邮件代码 ```php <?php namespace app\service\services; use app\lib\BaseService; use Symfony\Component\Mailer\Transport; use Symfony\Component\Mailer\Mailer; use Symfony\Component\Mime\Email; class MailService extends BaseService { public function sendMail() { $transport = Transport::fromDsn('smtp://账号:密码或者授权码@smtp.qq.com:587'); $mailer = new Mailer($transport); $email = (new Email()) ->from('发送者邮箱账号') ->to('接受者邮箱账号') //->cc('cc@example.com') //->bcc('bcc@example.com') //->replyTo('fabien@example.com') //->priority(Email::PRIORITY_HIGH) ->subject('标题') ->text('发送内容,与下面的html2选一'); //->html('<p>See Twig integration for better HTML integration!</p>'); return $mailer->send($email); } } ```
ysian
我雾化科所
1
聚合登录之创建应用篇
2024-07-30
645
0
2
php函数之match
2024-07-29
582
0
3
聚合登录之常见问题
2024-07-30
489
0
4
聚合登录之前后端示例代码
2024-07-30
483
0
5
聚合登录之获取登录链接
2024-07-30
422
0
6
服务器瘦身
2023-11-01
413
5
7
centos下升级openssl
2023-11-30
413
0
8
我的第一篇博客
2023-09-28
402
0
9
supervisor的安装与使用
2023-11-02
383
0
10
editor.md 代码块没有下拉框
2023-10-06
352
2
PHP [9]
linux [4]
sh [1]
闲谈 [1]
css [2]
redis [2]
Cluster集群 [1]
git [1]
centos [1]
webman [2]
工具 [1]
OAuth2.0 [1]
项目 [1]
初始化 [1]
thinkphp [1]
Nginx [1]
往事 [1]
Mysql [1]
支付宝 [2]
抖音 [2]
qq [2]
聚合 [1]
登录 [1]
聚合登录 [4]
cache [1]
html [1]
queue [1]
Workerman版本
4.1.15
Webman版本
1.5.9
PHP版本
8.3.6
MYSQL版本
8.2.24
操作系统
CENTOS