图片附件发送??但不会出现在电子邮件 Python smtp 中

Image attachment sends?? but doesnt apppear in email message Python smtp

我正在尝试将屏幕截图与电子邮件一起发送..

消息顺利通过。

在 Windows 实时邮件中它有附件图标。但是没有附件。

在线outlook 没有附件..

msg = MIMEMultipart('alternative')
msg['Subject'] = client_name + "  eBay Template " + date
msg['From'] = sender_address
msg['To'] = recipients_address
msg.preamble = 'images'

... # 附上截图

iways_filename = dictstr['ItemID'] + "_i-ways" + '.png'
ebay_filename = dictstr['ItemID'] + "_ebay" + '.png'
# iways
img_data = open(iways_filename, 'rb').read()
image = MIMEImage(img_data, name=os.path.basename(iways_filename))
msg.attach(image)
#ebay
img_data2 = open(ebay_filename, 'rb').read()
image = MIMEImage(img_data2, name=os.path.basename(ebay_filename))
msg.attach(image)   

我没有收到任何错误..

我找到了解决方案..

msg = MIMEMultipart('alternative')
msg['Subject'] = client_name + "  eBay Template " + date
msg['From'] = sender_address
msg['To'] = recipients_address
msg.preamble = 'images'

带走 'alternative' 瞧!

msg = MIMEMultipart()
msg['Subject'] = client_name + "  eBay Template " + date
msg['From'] = sender_address
msg['To'] = recipients_address
msg.preamble = 'images'