chrisbarr / mandrill-mailer
此包已废弃且不再维护。未建议替代包。
使用Mandrill Messages API发送邮件的类似SwiftMailer的接口
v0.1.1
2015-06-07 21:18 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~5.0
Requires (Dev)
- phpunit/phpunit: ~4.3
This package is auto-updated.
Last update: 2022-12-28 14:24:27 UTC
README
使用Mandrill Messages API发送邮件的类似SwiftMailer的接口
基本用法
使用composer引入
$ composer require chrisbarr/mandrill-mailer
或将其添加到您的composer.json文件中
{ "require": { "chrisbarr/mandrill-mailer": "~0.1" } }
然后可以这样使用
<?php require('vendor/autoload.php'); $mailer = new MandrillMailer/Mailer(MANDRILL_API_KEY); $message = new MandrillMailer/Message(); $message->setFrom('from@example.com', 'From User'); $message->setTo('to@example.com', 'To User'); $message->setSubject('This is my subject'); $message->setHtml('<p>Html goes here</p>'); $mailer->send($message);
参见
在此处了解有关Mandrill Messages API的更多信息:https://mandrillapp.com/api/docs/messages.JSON.html
在此处使用官方Mandrill PHP库:https://mandrillapp.com/api/docs/index.php.html
开发原因
- 我想使用一个比这个更好的接口:https://mandrillapp.com/api/docs/messages.php.html#method-send
- SwiftMailer在通过SMTP发送邮件方面表现优秀,但我找不到使用API发送消息的简单方法
- 我想使用Travis CI并被列入Packagist :)