我正在使用smtplib通过美国在线帐户发送电子邮件,但在成功验证后,它被拒绝,并出现以下错误。
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())这是不是某种权限问题,因为我成功地用雅虎帐户发送了相同的电子邮件,没有任何问题?
发布于 2015-09-30 21:45:39
我猜AOL默认情况下不允许中继访问,或者您没有手动配置它。您收到的错误说明aol没有您想要发送消息的收件人。在这种情况下,如果您想发送电子邮件到gmail帐户,请尝试连接到gmail SMPT服务器,而不是AOL。
例如,将smpt server更改为gmail-smtp-in.l.google.com并关闭身份验证。
发布于 2017-05-26 10:00:46
我自己在AOL SMTP中继站遇到了5.2.1 : AOL will not accept delivery of this message.。我最终需要的是MIME邮件正文中有效的From和To标头,而不仅仅是SMTP连接。
在您的特定情况下,可能有许多原因导致此5.2.1反弹。postmaster.aol.com站点提供了一些有用的工具来进行诊断,还提供了一些关于此特定错误消息的非常模糊的文档。在我的例子中,我最终嗅探了我的Thunderbird电子邮件客户端发送的SMTP消息和Python脚本的SMTP消息,并最终发现了其中的区别。
postmaster.aol.com文档:
https://postmaster.aol.com/error-codes
AOL将不接受此邮件的传递
这是由于以下原因造成的永久性反弹:
我的Python函数用于通过smtp.aol.com发送邮件:
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def genEmail(user, passwd, to, subject, message):
smtp=smtplib.SMTP_SSL('smtp.aol.com',465)
smtp.login(user, passwd)
msg = MIMEMultipart()
msg['Subject'] = subject
msg['From'] = user # This has to exist, and can't be forged
msg['To'] = to
msg.attach(MIMEText(message, 'plain'))
smtp.sendmail(user, to, msg.as_string())
smtp.quit()https://stackoverflow.com/questions/32867127
复制相似问题