raceback (most recent call last):
File "C:\Python24\Lib\site-packages\trac\ticket\web_ui.py", line 562, in _do_save
tn.notify(ticket, newticket=False, modtime=now)
File "C:\Python24\Lib\site-packages\trac\ticket\notification.py", line 129, in notify
NotifyEmail.notify(self, ticket.id, subject)
File "C:\Python24\Lib\site-packages\trac\notification.py", line 216, in notify
Notify.notify(self, resid)
File "C:\Python24\Lib\site-packages\trac\notification.py", line 114, in notify
self.begin_send()
File "C:\Python24\Lib\site-packages\trac\notification.py", line 287, in begin_send
self.server.login(self.user_name, self.password)
File "C:\Python24\lib\smtplib.py", line 591, in login
raise SMTPAuthenticationError(code, resp)
SMTPAuthenticationError: (334, 'UGFzc3dvcmQ6')
其实上述只是提供了一个程序调用的过程。在调用smtplib。py这个模块的时候出了问题
通过抓包显示(EHLO WINEYWFBF1TTDV 250-AUTH=LOGIN 250 AUTH LOGIN)。邮件服务器返回的是 auth=LOGIN,多了一个'=',所以我就在smtplib.py文件中的第569行加了这一段
if '='+method in authlist:
authmethod = method
break
以下程序(580行以下)
elif authmethod == AUTH_LOGIN:
(code, resp) = self.docmd("AUTH",
"%s %s" % (AUTH_LOGIN, encode_base64(user, eol="")))
if code != 334:
raise SMTPAuthenticationError(code, resp)
(code, resp) = self.docmd(encode_base64(password, eol=""))
elif authmethod is None:
raise SMTPException("No suitable authentication method found.")
if code not in [235, 503]:
# Three stage: 1. sent "AUTH LOGIN"; 2. sent "user name"; 3. sent "password".
# origial code combine stage 1 & 2 as below line:
#(code, resp) = self.docmd("AUTH","%s %s" % (AUTH_LOGIN, encode_base64(user, eol="")))
if code != 334:
raise SMTPAuthenticationError(code, resp)
(code, resp) = self.docmd(encode_base64(user, eol=""))
if code != 334:
raise SMTPAuthenticationError(code, resp)
(code, resp) = self.docmd(encode_base64(password, eol=""))
elif authmethod is None:
raise SMTPException("No suitable authentication method found.")
if code not in [235, 503]: