I use django backend to send email (but really django is irrevelant in this case), I can login via standalone client, but not via smtplib. I keep getting:
SMTPAuthenticationError (535, '5.7.0 authentication failed')
In my case It seems that the server lied it responded following string on hello request:
>>> conn.ehlo()
(250,
'edited.host.name Hello host.name [83.24.32.123], pleased to meet you\nENHANCEDSTATUSCODES\nPIPELINING\n8BITMIME\nSIZE\nDSN\nETRN\nAUTH GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN\nDELIVERBY\nHELP')
in which it annouced it supports CRAM-MD5
authentication method, which it didn't.
Since I was in a hurry and resolving this issue with admin would end in missing the deadline, I had to patch SMTP class to prefer PLAIN
authentication method. To do this you need to create subclass of SMTP_SSL
and override login
method, just copy login
from SMTP class changing one line.
Change line that says:
preferred_auths = [AUTH_CRAM_MD5, AUTH_PLAIN, AUTH_LOGIN]
to:
preferred_auths = [AUTH_PLAIN, AUTH_LOGIN]
Anyway I posted the patched class: http://pastebin.com/ecL9A3P4.