python中的smtplib sendmail失败SMTPHeloError:(501,b'5.5.4无效地址')

时间:2013-05-15 01:58:14

标签: python

我写了以下代码:

import smtplib
my_address = 'myaddress@msn.com'
hears = [ 'Subject: A test',
      'From: ' + my_address,
      'To: ' + my_address,
      ]
entries = "Hello"
msg ='r\n'.join(hears) + 'r\n' + ' '.join(entries)
smtp = smtplib.SMTP('smtp.live.com',587)
smtp.starttls('smtp.live.com')
smtp.sendmail(my_address, [my_address] , msg)
smtp.close()

我收到了错误消息:

Traceback (most recent call last):
File "C:\Python33\sssemail.py", line 11, in <module>
smtp.starttls('smtp.live.com')
File "C:\Python33\lib\smtplib.py", line 652, in starttls
self.ehlo_or_helo_if_needed()
File "C:\Python33\lib\smtplib.py", line 553, in ehlo_or_helo_if_needed
raise SMTPHeloError(code, resp)
smtplib.SMTPHeloError: (501, b'5.5.4 Invalid Address')

任何人都可以让我了解正在发生的事情吗?

0 个答案:

没有答案