Smtp Auth Extension Trouble With Python
Solution 1:
The error you get means the SMTP server you're talking to doesn't claim to support authentication. If you look at the debug output you'll see that none of the responses to your EHLO
s contain the necessary declaration for AUTH
. If it did (properly) support authentication, one of the responses would be something like:
250 AUTH GSSAPI DIGEST-MD5 PLAIN
(at least in reponse to the EHLO
after the STARTTLS
.) Because that response isn't included, smtplib assumes the server won't be able to handle the AUTH
command, and will refuse to send it. If you're certain your SMTP server does support the AUTH
command even though it doesn't advertise it, you can sneakily convince smtplib that it supports AUTH
by explicitly adding it to the set of features. You'll need to know which kind of authentication schemes are supported, and then you can do:
smtp.starttls()
smtp.ehlo()
# Pretend the SMTP server supports some forms of authentication.
smtp.esmtp_features['auth'] = 'LOGIN DIGEST-MD5 PLAIN'
... but of course making the SMTP server behave according to spec would be a better idea :)
Post a Comment for "Smtp Auth Extension Trouble With Python"