2017-06-01 76 views
0

我想發送屏幕截圖以及一封電子郵件消息。圖像附件發送?但沒有apppear在電子郵件蟒蛇smtp

消息通過罰款。

在Windows Live郵件中有附件圖標。但沒有附件。

在線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) 

我沒有得到任何錯誤..

回答

0

我找到了解決辦法..

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

拿走'替代'和Voila!

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