Change CakeEmail SMTP authentication type

2019-09-09 08:46发布

问题:

How do you change the authentication type that CakeEmail uses when using Smtp transport?

I get this error: SMTP Error: 504 5.7.4 Unrecognized authentication type when trying to send to a system that doesn't support Password authentication. It only supports NTLM. I haven't seen anything about setting the authentication type in the cookbook or API for CakePHP 2.5.1. Is there any way to manually change it?

回答1:

CakePHPs SMTP transport only supports basic username/password authentication, there are no other authentication types implemented, and there's also no specialized mechanism for plugging in authentication adapters or the like.

So you'll probably have to create a custom/extended SMTP transport.

I'm not familiar with NTLM, but judging from the RFC it should be possible to plug-in an implementation of the NTLM authentication flow in an overridden SmtpTransport::_auth() method.