使用python发送带附件的邮件
使用python发送带附件的邮件 #!/usr/bin/env python # -*- coding: utf-8 -*- from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.base import MIMEBase from email import utils, encoders import mimetypes, sys import smtplib import re import datetime def attachment(filename): fd = open(filename, “rb”) mimetype, mimeencoding = mimetypes.guess_type(filename) if mimeencoding or (mimetype is None): mimetype = “application/octet-stream” maintype, subtype […]