https://github.com/yiisoft/mailer-symfony
Yii Framework Symfony Mailer Integration
https://github.com/yiisoft/mailer-symfony
hacktoberfest mailer symfony yii3
Last synced: about 2 months ago
JSON representation
Yii Framework Symfony Mailer Integration
- Host: GitHub
- URL: https://github.com/yiisoft/mailer-symfony
- Owner: yiisoft
- License: bsd-3-clause
- Created: 2021-08-23T08:55:50.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-03-26T06:31:44.000Z (3 months ago)
- Last Synced: 2025-04-27T14:01:51.709Z (2 months ago)
- Topics: hacktoberfest, mailer, symfony, yii3
- Language: PHP
- Homepage: https://www.yiiframework.com/
- Size: 119 KB
- Stars: 12
- Watchers: 15
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
Yii Mailer - Symfony Mailer Extension
[](https://packagist.org/packages/yiisoft/mailer-symfony)
[](https://packagist.org/packages/yiisoft/mailer-symfony)
[](https://github.com/yiisoft/mailer-symfony/actions/workflows/build.yml)
[](https://codecov.io/gh/yiisoft/mailer-symfony)
[](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/mailer-symfony/master)
[](https://github.com/yiisoft/mailer-symfony/actions?query=workflow%3A%22static+analysis%22)
[](https://shepherd.dev/github/yiisoft/mailer-symfony)This package is an adapter for [yiisoft/mailer](https://github.com/yiisoft/mailer) relying on
[symfony/mailer](https://github.com/symfony/mailer).## Requirements
- PHP 8.1 or higher.
## Installation
The package could be installed with [Composer](https://getcomposer.org):
```shell
composer require yiisoft/mailer-symfony
```## General usage
Creating a mailer:
```php
use Yiisoft\Mailer\Symfony\Mailer;/**
* @var \Symfony\Component\Mailer\Transport\TransportInterface $transport
*/$mailer = new \Yiisoft\Mailer\Symfony\Mailer(
$transport,
);
```Sending a mail message:
```php
$message = (new \Yiisoft\Mailer\Message())
->withFrom('[email protected]')
->withTo('[email protected]')
->withSubject('Message subject')
->withTextBody('Plain text content')
->withHtmlBody('HTML content');
$mailer->send($message);
// Or several
$mailer->sendMultiple([$message]);
```Additional methods of the `Yiisoft\Mailer\Symfony\Mailer`:
- `withEncryptor()` - Returns a new instance with the specified encryptor instance.
- `withSigner()` - Returns a new instance with the specified signer instance.For more information about signing and encrypting messages, see the corresponding section of the
[documentation](https://symfony.com/doc/current/mailer.html#signing-and-encrypting-messages).For use in the [Yii framework](https://www.yiiframework.com/), see the configuration files:
- [`config/di.php`](https://github.com/yiisoft/mailer-symfony/blob/master/config/di.php)
- [`config/params.php`](https://github.com/yiisoft/mailer-symfony/blob/master/config/params.php)## Documentation
- [Yii guide to mailing](https://github.com/yiisoft/docs/blob/master/guide/en/tutorial/mailing.md)
- [Symfony Mailer documentation](https://symfony.com/doc/current/mailer.html)
- [Internals](docs/internals.md)If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).## License
The Yii Mailer - Symfony Mailer Extension is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.Maintained by [Yii Software](https://www.yiiframework.com/).
## Support the project
[](https://opencollective.com/yiisoft)
## Follow updates
[](https://www.yiiframework.com/)
[](https://twitter.com/yiiframework)
[](https://t.me/yii3en)
[](https://www.facebook.com/groups/yiitalk)
[](https://yiiframework.com/go/slack)