one problem about smtplib.py

Frank Zheng hust_zxq524 at 263.net
Thu May 13 03:42:26 EDT 2004


I wrote some code to test "smtplib", but i met a problem when i call the
"login(user,pass)" of the "SMTP" object.
here are the codes:

>>> s = smtplib.SMTP()
>>> s.set_debuglevel(1)
>>> s.connect('smtp.263.net')
connect: ('smtp.263.net', 25)
connect: ('smtp.263.net', 25)
reply: '220 Welcome to coremail System(With Anti-Spam) 2.1 for
263(040326)\r\n'
reply: retcode (220); Msg: Welcome to coremail System(With Anti-Spam) 2.1
for 263(040326)
connect: Welcome to coremail System(With Anti-Spam) 2.1 for 263(040326)
(220, 'Welcome to coremail System(With Anti-Spam) 2.1 for 263(040326)')
>>> s.login('Frank','*****')
send: 'ehlo pc11.FutureDialChina.FutureDialChina.com\r\n'
reply: '250-smtp.263.net\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-SIZE 30720000\r\n'
reply: '250-ETRN\r\n'
reply: '250-AUTH LOGIN\r\n'           # should be "250-AUTH PLAIN"
reply: '250-AUTH=LOGIN\r\n'
reply: '250-XVERP\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: smtp.263.net
PIPELINING
SIZE 30720000
ETRN
AUTH LOGIN
AUTH=LOGIN
XVERP
8BITMIME
AuthMethod: None
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "D:\tools\Python22\lib\smtplib.py", line 540, in login
    raise SMTPException("No suitable authentication method found.")
SMTPException: No suitable authentication method found.

I read the "login" of "smtplib" , I found it has two authentication method
one is "PLAIN", the other is "CRAM-MD5", but the server's reply here didn't
chose one of these two choices. I tested several mail-servers in China, they
all just support "AUTH LOGIN". I found the Outlook use "AUTH LOGIN" and make
it as standard.

So I think smtplib maybe need do some changes, or someone has already did
this work.

Thanks
Frank










More information about the Python-list mailing list