https://github.com/ossinkine/swiftmailer-punycode-plugin
🗿 Swiftmailer plugin to convert domain in email addresses to punycode
https://github.com/ossinkine/swiftmailer-punycode-plugin
punycode swiftmailer swiftmailer-plugin
Last synced: 27 days ago
JSON representation
🗿 Swiftmailer plugin to convert domain in email addresses to punycode
- Host: GitHub
- URL: https://github.com/ossinkine/swiftmailer-punycode-plugin
- Owner: ossinkine
- License: mit
- Created: 2018-01-17T15:23:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-11T11:01:19.000Z (over 7 years ago)
- Last Synced: 2025-12-14T10:53:47.194Z (5 months ago)
- Topics: punycode, swiftmailer, swiftmailer-plugin
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swiftmailer Punycode Plugin
[](https://travis-ci.org/ossinkine/swiftmailer-punycode-plugin)
Swiftmailer plugin to convert domain in email addresses to punycode.
## Installation
```bash
composer require ossinkine/swiftmailer-punycode-plugin
```
## Usage
Create and register a plugin instance when you setup a `Swift_Mailer` instance.
```php
use Ossinkine\Swift\Plugin\PunycodePlugin;
// Create the Mailer using any Transport
$mailer = new Swift_Mailer(
new Swift_SmtpTransport('smtp.example.org', 25)
);
// Register the plugin
$mailer->registerPlugin(new PunycodePlugin());
```
Now you can send an email to an address with Unicode-encoded domain.
```php
// Create a message with Unicode-encoded receiver address
$message = (new Swift_Message())
->setTo(['receiver@bücher.tld'])
;
// Send the message
$mailer->send($message);
```
## Usage with Symfony
Just register a service with a `swiftmailer.default.plugin` tag in your `services.yml`.
```yaml
Ossinkine\Swift\Plugin\PunycodePlugin:
tags: [swiftmailer.default.plugin]
```
## License
[Swiftmailer Punycode Plugin](https://github.com/ossinkine/swiftmailer-punycode-plugin) is licensed under the [MIT license](LICENSE).