File tree Expand file tree Collapse file tree 1 file changed +49
-1
lines changed
Expand file tree Collapse file tree 1 file changed +49
-1
lines changed Original file line number Diff line number Diff line change 1- # swiftmailer-punycode-plugin
1+ # Swiftmailer Punycode Plugin
2+
3+ Swiftmailer plugin to convert domain in email addresses to punycode.
4+
5+ ## Installation
6+
7+ ``` bash
8+ composer require ossinkine/swiftmailer-punycode-plugin
9+ ```
10+
11+ ## Usage
12+
13+ Create and register a plugin instance when you setup a ` Swift_Mailer ` instance.
14+
15+ ``` php
16+ use Ossinkine\Swift\Plugin\PunycodePlugin;
17+
18+ // Create the Mailer using any Transport
19+ $mailer = new Swift_Mailer(
20+ new Swift_SmtpTransport('smtp.example.org', 25)
21+ );
22+
23+ // Register the plugin
24+ $mailer->registerPlugin(new PunycodePlugin());
25+ ```
26+
27+ Now you can send an email to an address with Unicode-encoded domain.
28+
29+ ``` php
30+ // Create a message with Unicode-encoded receiver address
31+ $message = (new Swift_Message())
32+ ->setTo(['receiver@bücher.tld'])
33+ ;
34+ // Send the message
35+ $mailer->send($message);
36+ ```
37+
38+ ## Usage with Symfony
39+
40+ Just register a service with a ` swiftmailer.default.plugin ` tag in your ` services.yml ` .
41+
42+ ``` yaml
43+ Ossinkine\Swift\Plugin\PunycodePlugin :
44+ tags : [swiftmailer.default.plugin]
45+ ` ` `
46+
47+ ## License
48+
49+ [Swiftmailer Punycode Plugin](https://github.com/ossinkine/swiftmailer-punycode-plugin) is licensed under the [MIT license](LICENSE).
You can’t perform that action at this time.
0 commit comments