[Patches] [ python-Patches-1521196 ] smtplib login fails with aol smtp server

SourceForge.net noreply at sourceforge.net
Fri Mar 16 07:21:45 CET 2007


Patches item #1521196, was opened at 2006-07-12 13:32
Message generated for change (Comment added) made by aptshansen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1521196&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Peter (ps1956)
Assigned to: Nobody/Anonymous (nobody)
Summary: smtplib login fails with aol smtp server

Initial Comment:
Sending email to AOL's smtp server fails with "501
INVALID SASL FORMAT OR LENGTH".

This patch allows the default order (AUTH_CRAM_MD5,
AUTH_PLAIN, AUTH_LOGIN) used to select the AUTH method
to be overridden with a new optional preferred_auths
parameter.  By changing the order so that AUTH_LOGIN
comes before AUTH_PLAIN, AOL's smtp server is happy. 
This patch may be useful for other stmp servers that
fail on login when using the default AUTH selection order.

Sample usage:

if aol:
    auths = [smtplib.AUTH_CRAM_MD5, smtplib.AUTH_LOGIN,
smtplib.AUTH_PLAIN]
    smtp.login(fromUser.split("@")[0], passwd, auths)
else:
    smtp.login(fromUser, passwd)

I tested the patch using python 2.4.3 on slackware 10.2
 (kernel 2.4.32).


----------------------------------------------------------------------

Comment By: Stephen Hansen (aptshansen)
Date: 2007-03-16 06:21

Message:
Logged In: YES 
user_id=1720594
Originator: NO

This seems reasonable to me; the preference of which authentication modes
to use shouldn't be a hardcoded decision in smtplib, especially if one of
the biggest email servers around breaks if we can't.

However, I think it needs a couple things done before it should be
accepted:
  #1) The code patch itself needs to be done against the trunk, as it
doesn't currently apply cleanly (it's a trivial fix)
  #2) The documentation patch should include mention of the "constants" of
smtplib.AUTH_*


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1521196&group_id=5470


More information about the Patches mailing list