openbuildings / postmark
Postmark 的 Swiftmailer 传输类
0.5.0
2021-03-09 09:32 UTC
Requires
- php: ^7.1
- lib-curl: *
- swiftmailer/swiftmailer: ^6
Requires (Dev)
- phpunit/phpunit: ^7
Suggests
- openbuildings/swiftmailer-css-inliner: Inline the CSS of your HTML emails
- openbuildings/swiftmailer-filter: Whitelist or blacklist domains or emails from To, Cc and Bcc
- openbuildings/swiftmailer-google-campaign: Append to all email links Google UTM campaign parameters
README
Swiftmailer 的一个功能齐全的 Postmark 传输,允许附件、HTML 邮件/部分、抄送、密送以及通过单个 API 调用发送多封邮件。
用法
$transport = Swift_PostmarkTransport::newInstance('your api key'); $mailer = new Swift_Mailer($transport); $message = new Swift_Message(); // Add stuff to your message $message->setFrom('test@example.com'); $message->setTo('test2@example.com'); $message->setSubject('Test'); $message->setBody('Test Email'); $mailer->send($message);
与 Symfony 2 的用法
将 Postmark 传输定义为服务
services: swift_transport.postmark: class: Openbuildings\Postmark\Swift_PostmarkTransport arguments: - POSTMARK_API_KEY
在 config.yml 中将传输更改为定义的服务
swiftmailer: transport: swift_transport.postmark
许可证
版权 (c) 2012-2013, OpenBuildings Ltd. 由 Ivan Kerin 在 clippings.com 中开发。
在 BSD-3-Clause 许可下,请参阅 LICENSE 文件。