yiisoft / mailer
Sending email abstraction
Fund package maintenance!
Opencollective
yiisoft
Installs: 91 559
Dependents: 17
Suggesters: 0
Security: 0
Stars: 28
Watchers: 17
Forks: 11
Open Issues: 3
Requires
- php: ^8.1
Requires (Dev)
- maglnet/composer-require-checker: ^4.4
- phpunit/phpunit: ^10
- psr/event-dispatcher: ^1.0
- rector/rector: ^1.2
- roave/infection-static-analysis-plugin: ^1.25
- spatie/phpunit-watcher: ^1.23
- vimeo/psalm: ^5.24
- yiisoft/aliases: ^3.0
- yiisoft/definitions: ^3.3
- yiisoft/di: ^1.2
- yiisoft/files: ^2.0
- yiisoft/test-support: ^3.0
Suggests
- psr/event-dispatcher: Use PSR Event Dispatcher implementation for process before/after send events
- yiisoft/event-dispatcher: Yii Event Dispatcher
- yiisoft/mailer-symfony: `symfony/mailer` based driver for send emails
README
Yii Mailer
The package provides abstraction for sending emails via mailer and message interfaces. Actual mail sending is provided by separate interchangeable packages.
The following mailers are available out of the box:
FileMailer
- writes message to files instead of actually sending email.StubMailer
- keeps messages in memory and doesn't send them.NullMailer
- does nothing.
Yii Mailer extensions:
- Yii Symfony Mailer - symfony/mailer adapter.
Requirements
- PHP 8.1 or higher.
Installation
The package could be installed with Composer:
composer require yiisoft/mailer
General usage
The following code can be used to send an email:
/** * @var \Yiisoft\Mailer\MailerInterface $mailer */ $message = (new \Yiisoft\Mailer\Message()) ->withFrom('from@domain.com') ->withTo('to@domain.com') ->withSubject('Message subject') ->withTextBody('Plain text content') ->withHtmlBody('<b>HTML content</b>'); $mailer->send($message);
Documentation
If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.
License
The Yii Mailer is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.
Maintained by Yii Software.