【发布时间】:2015-12-28 07:12:36
【问题描述】:
我正在使用smtplib 通过 AOL 帐户发送电子邮件,但在成功验证后它被拒绝并出现以下错误。
reply: '521 5.2.1 : AOL will not accept delivery of this message.\r\n'
reply: retcode (521); Msg: 5.2.1 : AOL will not accept delivery of this message.
data: (521, '5.2.1 : AOL will not accept delivery of this message.')
这里是这个错误的解释。
The SMTP reply code 521 indicates an Internet mail host DOES NOT ACCEPT
incoming mail. If you are receiving this error it indicates a configuration
error on the part of the recipient organisation, i.e. inbound e-mail traffic
is being routed through a mail server which has been explicitly configured
(intentionally or not) to NOT ACCEPT incoming e-mail.
收件人邮件(在我的脚本中)是有效的 (gmail) 地址,并且在此调试消息后邮件被拒绝。
send: 'Content-Type: text/plain; charset="us-ascii"\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: 7bit\r\nSubject: My reports\r\nFrom: myAOLmail@aol.com\r\nTo: reportmail@gmail.com\r\n\r\nDo you have my reports?\r\n.\r\n'
这是代码的简短版本:
r_mail = MIMEText('Do you have my reports?')
r_mail['Subject'] = 'My reports'
r_mail['From'] = e_mail
r_mail['To'] = 'reportmail@gmail.com'
mail = smtplib.SMTP("smtp.aol.com", 587)
mail.set_debuglevel(True)
mail.ehlo()
mail.starttls()
mail.login(e_mail, password)
mail.sendmail(e_mail, ['reportmail@gmail.com'] , r_mail.as_string())
这是某种权限问题,因为我使用 Yahoo 帐户成功发送了相同的电子邮件,没有任何问题吗?
【问题讨论】:
-
您可以从同一个 AOL 帐户发送电子邮件吗?我的意思是使用网络浏览器。这个问题是 AOL 方面的问题。
-
@ρss 谢谢!我得检查一下这个帐户有什么问题。我刚刚尝试了另一个帐户,它成功了。
-
是的,正如我所提到的,该特定帐户或 AOL 存在问题。 python脚本没有问题!也许您违反了 AOL 电子邮件服务的条款和条件,或者此 AOL 帐户正在发送垃圾邮件。
标签: python mail-server smtplib aol