色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

網頁爬蟲 - python+smtp發送郵件附件問題

瀏覽:124日期:2022-06-30 17:08:30

問題描述

文件是txt或者word格式的,但是要求附件發送過去是pdf格式的,smpt有沒有什么參數是可以設置的,我設置了_subtype='pdf',最后附件打開會報錯,說不是一個pdf文件,打不開

import smtplibfrom email.mime.multipart import MIMEMultipartfrom email.mime.application import MIMEApplicationimport tracebackimport osserver=smtplib.SMTP()server.connect('smtp.163.com')server.login('XXXXXX@163.com','YYYYYY')msg=MIMEMultipart(’’)msg[’From’]='XXXXXX@163.com'msg[’Subject’]='opp'part = MIMEApplication(open('D:log.txt', ’rb’).read(),_subtype=’pdf’)#filetype='pdf'filetype = os.path.splitext('D:log.txt')[-1][1:]newfilename = ’resume’ + ’.’ + filetypepart.add_header(’Content-Disposition’, ’attachment’, filename=newfilename)msg.attach(part)msg[’To’]='TTTTTT@163.com'server.send_message(msg)

求解直接報filetype改成pdf也會文件報錯

問題解答

回答1:

SMTP is the protocol you are sending the completed email with, the MIME type is the content type of the attachment as declared in the email and the actual content type the file has. If you want to send a doc file as pdf you have to convert it first.

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 久久九九色 | 欧美一级久久久久久久久大 | 免费人成在线观看视频不卡 | 一级真人毛片 | 碰碰碰精品视频在线观看 | 久久夜色精品国产 | 亚洲精品国产精品国自产观看 | 欧美精品亚洲精品日韩一区 | 在线人成精品免费视频 | 日本人的色道www免费一区 | 狠狠色婷婷丁香综合久久韩国 | 九九在线精品视频xxx | 黑人巨大videos极度另类 | 久久爱青青草 | 免费一区区三区四区 | 国产高清一区二区三区四区 | 国产亚洲精品激情一区二区三区 | 免费在线黄色网址 | 免看一级a毛片一片成人不卡 | 男人天堂久久 | 永久黄网站色视频免费网站 | 亚洲国产日韩欧美高清片a 亚洲国产日韩欧美在线 | 国产一级做a爱片久久毛片a | 五月色婷婷综合开心网亚 | 亚洲精品一区二区观看 | 国产精品变态重口在线 | a大片久久爱一级 | 日韩美一区二区 | 中文精品爱久久久国产 | 国产短视频精品一区二区三区 | 国产高清免费影视在线观看 | 正在播放的国产a一片 | 亚洲情a成黄在线观看 | 国产午夜亚洲精品国产 | 成人国产在线看不卡 | 青青爽国产手机在线观看免费 | 国产精品久久久久久久 | 日韩欧美~中文字幕 | 久草手机在线观看视频 | 成人合成mv福利视频网站 | 亚洲一区二区三区精品国产 |