午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

瀏覽:212日期: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 編程
相關文章:
主站蜘蛛池模板: 日韩亚洲天堂 | 免费萌白酱国产一区二区三区 | 成年人免费在线观看视频网站 | 天天干天天草 | 九九九九精品 | 99久久精品一区 | av免费看片| 国产三级视频在线 | 免费成人高清在线视频 | 午夜精品久久久 | 少妇无套高潮一二三区 | 99精品福利视频 | 久久久久久久艹 | 免费特级毛片 | 亚洲国产黄色 | 欧美黄色录像 | 欧美人与性动交α欧美精品 | 亚洲天堂网在线观看 | 亚洲精品久久久久国产 | 欧美午夜理伦三级在线观看 | 日本熟伦人妇xxxx | 欧美日韩中文字幕在线观看 | 天堂在线一区二区 | 日韩精品视频网 | 亚洲黄色天堂 | 久久精品中文字幕 | 欧美 日韩 中文字幕 | 亚洲三级a | www.日韩av| 久久国产区| 成人黄色a级片 | 色综合久久久久 | 岛国av网 | 久久久视频在线 | 九九看片 | 精久久久 | 国产成人精品免费视频 | 国产精品久久久久永久免费看 | 国产探花系列 | 无套暴操 | 久久国产精品影视 |