求助python发邮件无主题问题
1个回答
展开全部
下面是代码:
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
from email.header import Header
def sendmail():
global Kyewoed
global Mid
global Memail
global te
#创建一个带附件的实例
msg = MIMEMultipart()
#构造附件1
att1 = MIMEText(open('E:/1.txt', 'rb').read(), 'plain', 'utf-8')
#att1 = MIMEText(open('E:/1.txt', 'rb').read(), 'plain', 'utf-8')
att1["Content-Type"] = 'text'
att1["Content-Disposition"] = 'attachment; filename=q.txt'#这里的filename可以任意写,写什么名字,邮件中显示什么名字!
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
from email.header import Header
def sendmail():
global Kyewoed
global Mid
global Memail
global te
#创建一个带附件的实例
msg = MIMEMultipart()
#构造附件1
att1 = MIMEText(open('E:/1.txt', 'rb').read(), 'plain', 'utf-8')
#att1 = MIMEText(open('E:/1.txt', 'rb').read(), 'plain', 'utf-8')
att1["Content-Type"] = 'text'
att1["Content-Disposition"] = 'attachment; filename=q.txt'#这里的filename可以任意写,写什么名字,邮件中显示什么名字!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询