ossinkine / swiftmailer-punycode-plugin
该软件包已被弃用且不再维护。作者建议使用 swiftmailer/swiftmailer:^6.1 软件包。
Swiftmailer 插件,用于将电子邮件地址中的域名转换为 punycode 编码。
v1.0.0
2018-01-18 07:26 UTC
Requires
- php: ^7.0
- swiftmailer/swiftmailer: ^6.0
- true/punycode: ^2.0
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2022-02-01 13:11:57 UTC
README
Swiftmailer 插件,用于将电子邮件地址中的域名转换为 punycode。
安装
composer require ossinkine/swiftmailer-punycode-plugin
使用方法
在设置 Swift_Mailer
实例时创建并注册插件实例。
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());
现在您可以向具有 Unicode 编码域名的地址发送电子邮件。
// Create a message with Unicode-encoded receiver address $message = (new Swift_Message()) ->setTo(['receiver@bücher.tld']) ; // Send the message $mailer->send($message);
与 Symfony 一起使用
只需在您的 services.yml
中注册带有 swiftmailer.default.plugin
标签的服务。
Ossinkine\Swift\Plugin\PunycodePlugin: tags: [swiftmailer.default.plugin]