当前位置:网站首页>[symfony/mailer] An elegant and easy-to-use mail library
[symfony/mailer] An elegant and easy-to-use mail library
2022-08-02 03:52:00 【phpreturn】
Email seems to be outdated, but there are some scenarios where email notifications are still the most appropriate solution.
Compared with WeChat reminder and DingTalk reminder, email reminder is not limited to platforms, and has stronger content display capabilities, and various operating systems have powerful email clients. If we build an email server by ourselves, any sendingIt's all free, and we still deal with email a lot.
symfony/mailer is a new generation of mail manipulation library, using it to send mail is easier than writing database queries:
use Symfony\Component\Mailer\Transport;use Symfony\Component\Mailer\Mailer;$transport = Transport::fromDsn('smtp://localhost');$mailer = new Mailer($transport);$email = (new Email())->from('[email protected]')->to('[email protected]')//->cc('[email protected]')//->bcc('[email protected]')//->replyTo('[email protected]')//->priority(Email::PRIORITY_HIGH)->subject('Time for Symfony Mailer!')->text('Sending emails is fun again!')->html('See Twig integration for better HTML integration!
');$mailer->send($email);He supports standard mailbox protocols:
| smtp | smtp://user:[email protected]:25 | SMTP server |
| sendmail | sendmail://default | Use local email client to send |
| native | native://default | Email directory configured with php |
There are also popular mailbox service platforms built in:
| Amazon SES | composer require symfony/amazon-mailer |
| Gmail | composer require symfony/google-mailer |
| MailChimp | composer require symfony/mailchimp-mailer |
| Mailgun | composer require symfony/mailgun-mailer |
| Mailjet | composer require symfony/mailjet-mailer |
| Postmark | composer require symfony/postmark-mailer |
| SendGrid | composer require symfony/sendgrid-mailer |
| Sendinblue | composer require symfony/sendinblue-mailer |
| OhMySMTP | composer require symfony/oh-my-smtp-mailer |
It also has many advanced component operations built in, such as html templates, compiling css to inline styles, etc.is our go-to tool for sending emails.
边栏推荐
猜你喜欢
随机推荐
Error in render: “TypeError: Cannot read properties of null (reading ‘0‘)“ 报错解决方案
由中序遍历和后序遍历得到前序遍历(树的遍历)
骨架效果 之高级渐变,适用图片等待时
v-bind用法:类动态绑定对象 数组 style样式 及函数方法
[sebastian/diff]一个比较两段文本的历史变化扩展库
IO流、字节流、字节缓冲流
v-on基本使用、参数传递、修饰词
数组的高级操作
--fs module--
点名系统和数组元素为对象的排序求最大值和最小值
uniapp | 开发中遇到的兼容性问题(待续)
C语言入门小游戏—三子棋
解决5+APP真机测试无法访问后台(同局域网)
4.14到新公司的一天
区间问题 : 今年暑假不AC
C语言中关于2的n次方求值问题(移位运算)
如何根据地图上的两个坐标点来确定方向
微信小程序怎么批量生成带参数的小程序码?
STM32 map文件解析
微信小程序九宫格抽奖和转盘抽奖的实现









