简体   繁体   English

Amazon SES 失败,返回 smtp retcode 250

[英]Amazon SES failure with smtp retcode 250

I try to send email with amazon SES API docs below, and python return the code 250 meaing OK but my email got a failure message.我尝试使用下面的亚马逊 SES API 文档发送 email,python 返回代码 250,表示正常,但我的 email 收到一条失败消息。 Could anyone kindly tell me what maybe the problem?谁能告诉我可能是什么问题? thank you谢谢你

python: python:

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

# https://us-east-2.console.aws.amazon.com/sesv2/home?region=us-east-2#/account
# https://console.aws.amazon.com/iam/home?#/s=SESHomeV4/us-east-2
mail_host = "email-smtp.us-east-2.amazonaws.com"
mail_user = "AKI....T7H"
mail_pass = "BHJ.....iS/x"

sender = 'thelou1s@...com'
receivers = 'thelou1s@...com'

msg = MIMEMultipart()
msg['From'] = sender
msg['To'] = receivers
msg['Subject'] = 'simple email in python'
message = 'here is the email'
msg.attach(MIMEText(message))

try:
    print("try smtplib.SMTP")
    smtp = smtplib.SMTP(mail_host, 587)
    smtp.set_debuglevel(True)

    print("try connect")
    smtp.ehlo()
    smtp.starttls()
    smtp.ehlo()
    # smtpObj.connect(mail_host, 465)

    print("try login")
    smtp.login(mail_user, mail_pass)
    print("try sendmail: " + msg.as_string())
    smtp.sendmail(sender, receivers, msg.as_string())
    print("Send Success")
    smtp.close()
except smtplib.SMTPException:
    print("Send Error")

log (Is retcode 250 means success in code side or user side?):日志(retcode 250 是代码端成功还是用户端成功?):

reply: retcode (250); Msg: b'Ok 010f017d8f0f1703-d018f2a9-833e-428e-9010-5e45818e51e4-000000'
data: (250, b'Ok 010f017d8f0f1703-d018f2a9-833e-428e-9010-5e45818e51e4-000000')
Send Success

emails from amazon:来自亚马逊的电子邮件:

Delivery Status Notification (Failure)
An error occurred while trying to deliver the mail to the following recipients:
thelou1s@...com
here is the email

Just validate your email in amazon console只需在亚马逊控制台中验证您的 email

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM