- 论坛徽章:
- 0
|
当我开启瑞星杀毒软件的邮件发送监视时,如下的代码就出现错误。
如下函数是文件sender.py的一段函数,错误指向这个函数。
- #messageList是POP提取的发件人地址和发件人发件日期的列表
- #发送邮件
- def smtpconn(host,account,password,*messageList):
- messageCount=len(messageList)
- if messageCount<=0:
- print "No Address to sender"
- else:
- content='<html xmlns="http://www.w3.org/1999/xhtml">' \
- '<head>' \
- '<title>Kinca Web</title>' \
- '</head>' \
- '<body>' \
- 'Welcome to <a href="http://web.kinca.net">Kinca Web</a> field!' \
- '</body>' \
- '</html>'
- message=MIMEText(content,_subtype='html',_charset='shift_jis')
- message['subject']=Header('Confirm from Kinca web!','shift_jis')
- message['from']='Kinca Web Mail <man@kinca.net>'
- sender='man@kinca.net'
-
- mailOutBox=smtplib.SMTP()
- mailOutBox.connect(host)
- mailOutBox.login(account,password)
-
- for selected in range(0,messageCount):
- if messageList[selected][0]=='' or messageList[selected][0] is None:
- continue
- else:
- message['to']=None
- #message['to']=messageList[selected][0]
- mailOutBox.sendmail(sender,messageList[selected][0],message.as_string())
- mailOutBox.quit()
复制代码
错误提示如下
- Traceback (most recent call last):
- File "C:\Program Files\Python24\lib\threading.py", line 442, in __bootstrap
- self.run()
- File "sender.py", line 148, in run
- smtpconn(SMTPhost,account,password,*messageList)
- File "sender.py", line 71, in smtpconn
- mailOutBox.sendmail(sender,messageList[selected][0],message.as_string())
- File "C:\Program Files\Python24\lib\smtplib.py", line 692, in sendmail
- raise SMTPDataError(code, resp)
- SMTPDataError: (354, '')
复制代码
系统Windows XP.当关闭邮件发送监视时,程序正常。
[ 本帖最后由 sunable 于 2006-3-23 14:26 编辑 ] |
|