标签:
# -*- coding: utf-8 -*- import smtplib host = ‘发件邮件服务器地址‘ subject = ‘主题‘ recipients = ‘收件人邮箱‘ sender = ‘发件人邮箱‘ content = ‘‘‘内容‘‘‘ body = ‘\r\n‘.join(( ‘From: %s‘ % sender, ‘To: %s‘ % recipients, ‘Subject: %s‘ % subject, ‘‘, content )) server = smtplib.SMTP() server.connect(host, ‘25‘) server.login(‘发件人邮箱‘, ‘密码‘) server.sendmail(sender, [recipients], body) server.quit()
备注:如果出现中文乱码的现象,请将文件的编码改成ASNI。
标签:
原文地址:http://www.cnblogs.com/yestreenstars/p/5751728.html