项目作者: yiisoft

项目描述 :
Generic mailer
高级语言: PHP
项目地址: git://github.com/yiisoft/mailer.git
创建时间: 2019-04-14T09:38:35Z
项目社区:https://github.com/yiisoft/mailer

开源协议:BSD 3-Clause "New" or "Revised" License

下载




Yii

Yii Mailer




Latest Stable Version
Total Downloads
Build status
Code Coverage
Mutation testing badge
static analysis
psalm-level
type-coverage

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:

Requirements

  • PHP 8.1 or higher.

Installation

The package could be installed with Composer:

  1. composer require yiisoft/mailer

General usage

The following code can be used to send an email:

  1. /**
  2. * @var \Yiisoft\Mailer\MailerInterface $mailer
  3. */
  4. $message = (new \Yiisoft\Mailer\Message())
  5. ->withFrom('from@domain.com')
  6. ->withTo('to@domain.com')
  7. ->withSubject('Message subject')
  8. ->withTextBody('Plain text content')
  9. ->withHtmlBody('<b>HTML content</b>');
  10. $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.

Support the project

Open Collective

Follow updates

Official website
Twitter
Telegram
Facebook
Slack