msg = MIMEMultipart()
msg['Subject'] = 'Some subject'
msg['From'] = 'noreply@xyz.com'
msg['Date'] = cur_date.isoformat(sep= ' ')
msg['To'] = COMMASPACE.join(['super@xyz.com', 'other@xyz.com'])
part = MIMEBase('application', 'octet-stream')
payload = "some generated payload message"
part.set_payload(payload)
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename=%s.csv' % yesterday.strftime('%Y%m%d'))
msg.attach(part)
s = smtplib.SMTP(host='email-smtp.us-east-1.amazonaws.com', port='587')
s.ehlo()
s.starttls()
s.login('user', 'psw')
print("Sending mail..")
s.sendmail('noreply@xyz.com', ['super@xyz.com', 'other@xyz.com'], msg.as_string())
s.quit()
print("Mail Sent")
我正在使用amazon ses通过python发送附件的电子邮件。我收到以下错误 -
smtplib.SMTPDataError: (554, 'Message rejected: Email address is not verified.')
我的“发件人”地址已经过验证,并且来自JAVA中其他代码部分的电子邮件正在使用相同的电子邮件地址集。我错过了什么,好像我使用'smtp.gmail.com'和我的凭据一样。