0

将来我想用Symfony/Mailer v6.x 替换已弃用的 SwiftMailer v6.2.5。独立,没有 Symfony,但这与这里的主题无关。

  1. 这是设置用户名+密码的正确转换吗?

斯威夫特梅勒

$transport = (new Swift_SmtpTransport('localhost', 25))
->setUsername($username)
->setPassword($password);

Symfony/邮件程序

$transport = Transport::fromDsn('smtp://'.urlencode($username).':'.urlencode($password).'@localhost:25');
  1. SwiftMailer 有一个AntiFlood 插件
$mailer = new Swift_Mailer($transport);
$mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 5));

我无法为 Mailer 找到这个。有替代方案吗?

  1. 对于失败的收件人SwiftMailer 我们使用这种语法
$successfulRecipients = $mailer->send($message, $failedRecipients);

如何在 Mailer 中找到失败的收件人?也许在TransportExceptionInterface的 try/catch 中,但没有具体返回的示例。

我发现 SwiftMailer 中的文档更好,更易于理解。谁能帮我解答这些问题?谢谢!

4

0 回答 0