Using smtplib login with esmtp

Gerhard Häring gerhard.haering at gmx.de
Thu Aug 1 14:21:27 EDT 2002


* Samir Patel <mepython at yahoo.com> [2002-08-01 10:15 -0700]:
> I am trying to  send login request with smtplib using
> login methond of SMTP, it returns with following
> error:
> "smtplib.SMTPException: No suitable authentication
> method found."
> 
> I think this is happening because it is using esmtp.
> this is what esmtp_features returns:
> {'8bitmime': '', 'auth': '=LOGIN', 'size': ''}
> 
> Can somebody tells me what I need to change to use
> esmtp login?

Unfortunately, SMTP AUTH doesn't currently work in Python's smtplib when
old-style AUTH advertisement (lines starting with auth=) are sent by the
smtp server. There is a patch of me lying at Sourceforge that will most
likely make it into Python 2.3. As this problem was asked here twice on
this mailing list, it would IMO also be wiese to backport the bugfix for
an upcoming Python 2.2.2. Opinions?

I've already done the backport, both for me personally, and for somebody
with whom I discussed the problem in private mail.

The fixed Python 2.2-compatible smtplib.py is available here:

    http://www.cs.fhm.edu/~ifw00065/VitaminP/smtplib.py

As an additional bonus, it includes support for the LOGIN auth
mechanism, as there are some b0rken servers, which only seem to support
LOGIN, but neither PLAIN nor CRAM-MD5: some flavours of M$ Exchange, for
example.  In particular the one I have to use at work, which is why I
came up with this patch in the first place.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 21.7 °C      Wind: 1.6 m/s




More information about the Python-list mailing list