直接上代码了
复制代码 代码如下:import smtplibmsg = MIMEMultipart()
#构造附件1att1 = MIMEText(open(‘/home/a2bgeek/develop/python/hello.py’, ‘rb’).read(), ‘base64’, ‘gb2312’)att1[“Content-Type”] = ‘application/octet-stream’att1[“Content-Disposition”] = ‘attachment; file