# -*- 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。

posted on 2016-08-09 08:53  昨、夜星辰  阅读(204)  评论(0)    收藏  举报