使用python发送带附件的邮件

Posted by 4Aiur on 04/06/2010 in 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 […]

Tags: ,

Copyright © 2010-2019 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.