当前位置:网站首页>[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.
边栏推荐
猜你喜欢
随机推荐
微信小程序九宫格抽奖和转盘抽奖的实现
第一篇博客
相对路径和绝对路径
枚举法方法:(leetcode1300)转变数组后最接近目标值的数组和
第一次手撕代码,如何解出全排列问题
ES6迭代器解释举例
js takes the value of a feature at a certain position in the string, such as Huawei=> Huawei
---static page---
URL URL
DOM manipulation---magnifying glass case
--fs模块--
IO流、 编码表、 字符流、 字符缓冲流
环形链表---------约瑟夫问题
--fs module--
L1-020 帅到没朋友 (20分)
STM32 map文件解析
v-on基本使用、参数传递、修饰词
npm和package.json
1.10今日学习
微信小程序云开发-证件照的实现









