w1ldzer0 / smtp-mailer
A very lightweight PHP email sender
v2.1.2
2018-06-07 13:02 UTC
Requires
- php: >=5.3.2
- psr/log: ~1.0
Requires (Dev)
- league/container: ~2.0
- monolog/monolog: ~1.13
This package is not auto-updated.
Last update: 2021-03-13 02:21:13 UTC
README
=======
A lightweight mail sender, credits to https://github.com/txthinking/Mailer for the inspiration and SMTP server.
Installation
$ composer require w1ldzer0/smtp-mailer
Usage
<?php use w1ldzer0\smtp-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') ->setHeader('List-Unsubscribe', 'mailto:unsub@unsub@mydomain.com') ->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.