laasti/mailer
最新稳定版本:v2.1.1
Composer 安装命令:
composer require laasti/mailer
包简介
A very lightweight PHP email sender
README 文档
README
=======
A lightweight mail sender, credits to https://github.com/txthinking/Mailer for the inspiration and SMTP server.
Installation
$ composer require laasti/mailer
Usage
<?php use Laasti\Mailer; $server = new Servers\SMTP($logger, $host, $username, $password, $port); $ok = (new Mailer($server)) ->setFrom('You', '') //your name, your email ->setFakeFrom('heelo', 'bot@fake.com') // if u want, a fake name, a fake email ->addTo('Cloud', 'cloud@txthinking.com') ->setSubject('Test Mailer') ->setBody('Hi, I <strong>love</strong> you.') ->addAttachment('host', '/etc/hosts') ->send(); var_dump($ok);
OR
<?php use Laasti\Mailer\Servers\SMTP; use \Laasti\Mailer\Message; use \Monolog\Logger; $server = new SMTP($logger, $host, $username, $password, $port); $mailer = new Mailer($server); $message = new Message(); $message->setFrom('Tom', 'your@mail.com') // your name, your email ->setFakeFrom('heelo', 'bot@fake.com') // if u want, a fake name, a fake email ->addTo('Cloud', 'cloud@txthinking.com') ->setSubject('Test Mailer') ->setBody('<h1>For test</h1>') ->addAttachment('host', '/etc/hosts'); $ok = $mailer->send($message); var_dump($ok);
A number of servers are available: FileServer (prints message to file), Mail, NullServer (does nothing), SMTP, Sendmail
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
History
See CHANGELOG.md for more information.
Credits
Author: Sonia Marquette (@nebulousGirl)
License
Released under the MIT License. See LICENSE file.
统计信息
- 总下载量: 376
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-15