Generic 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:
The package could be installed with Composer:
composer require yiisoft/mailer
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);
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.
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.