是否有正确的方法在symfony中使用SwiftMailer包将NTLM auth类型添加到SwiftMailer中?

时间:2016-04-05 06:08:01

标签: php symfony swiftmailer ntlm

我有swiftMailer包的symfony项目。我试图使用NTLM auth通过swiftmailer发送电子邮件。但我还没有找到通过配置捆绑打开NTLM的方法。

经过努力,我找到了解决方案

第一个解决方案

current($this->get('mailer')->getTransport()->getExtensionHandlers())
    ->setAuthenticators([new \Swift_Transport_Esmtp_Auth_NTLMAuthenticator()]);

在config.yml中注释spool

#    spool:     { type: memory }

但它看起来有点奇怪。

第二个解决方案

删除SwiftMailer包并直接使用swiftMailer,因为默认情况下会激活ntlm auth类型。

有没有更好的方法来使用NTLM auth类型?

1 个答案:

答案 0 :(得分:1)

我创建的pull request已获批准。

从版本v3.0.4开始,您可以使用

  auth_mode: ntlm

您可以使用命令

安装v3.0.4版本
composer require symfony/swiftmailer-bundle:^3.0.4