Skip to content

Commit

Permalink
Readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ossinkine committed Jan 18, 2018
1 parent 6304c54 commit 5d15d97
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
# swiftmailer-punycode-plugin
# 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).

0 comments on commit 5d15d97

Please sign in to comment.