当前位置:网站首页>[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.
边栏推荐
猜你喜欢
随机推荐
阿里云服务器如何使用admin账户登录
uniapp | 使用npm update更新后编译报错问题
L1-020 帅到没朋友 (20分)
STM32 CAN过滤器
如何计算地球上两点的距离(附公式推导)
PHP8.2中字符串变量解析的新用法
vue3 访问数据库中的数据
DOM manipulation---magnifying glass case
display,visibility,opacity
每日五道面试题总结 22/7/20
点名系统和数组元素为对象的排序求最大值和最小值
js scope and closure
客户评分控件
js基础知识
相对路径和绝对路径
骨架效果 之高级渐变,适用图片等待时
C语言中关于2的n次方求值问题(移位运算)
Circular linked list---------Joseph problem
Living to detect the Adaptive Normalized Representation Learning for GeneralizableFace Anti - Spoofing reading notes
js 原型和原型链