Is there a proper way to add NTLM auth type into SwiftMailer using SwiftMailer bundle in symfony?
Asked Answered
R

1

14

I have symfony project with swiftMailer bundle. I was trying to send email via swiftmailer using NTLM auth. But I have not found a way to turn on NTLM via configuration of the bundle.

After struggling with it I have found solution

First solution

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

Comment spool in config.yml

#    spool:     { type: memory }

But it's look a little bit weird.

Second solution

Remove SwiftMailer bundle and use swiftMailer directly, because ntlm auth type activated by default.

Is there a better way to use NTLM auth type?

Rothberg answered 5/4, 2016 at 6:8 Comment(4)
Your current solution/hack takes 1 line of code... As long as NTLM will not be supported by the swift mailer bundle, I doubt you could find a better solution...Tomasz
@Kadriles, I mean via events or/and config. With working spool.Rothberg
symfony.com/doc/current/reference/configuration/swiftmailer.html#auth-mode - Valid values are plain, login, cram-md5, or null. computer says no for the moment directly from the config. I did find in vendor/swiftmailer/swiftmailer/lib/preferences.php. Could you make your declaration in this file? I know it's in the vendor file and probably be overwritten on update but, if you want cleaner code, worth a shot and then leaving a noteDip
According to this question #22502558 you can use smtp transport and default auth_mode.Iquitos
S
3

I created pull request which got approved.

Since version v3.0.4 you can use

  auth_mode: ntlm

You can install v3.0.4 version using command

composer require symfony/swiftmailer-bundle:^3.0.4
Shenika answered 10/9, 2017 at 19:13 Comment(1)
Super. . . . . .Rothberg

© 2022 - 2024 — McMap. All rights reserved.