实现Python代码发送邮件


import
smtplib from email.mime.text import MIMEText from email.utils import formataddr msg = MIMEText('邮件内容', 'plain', 'utf-8') msg['From'] = formataddr(["jassin", 'jassin_du@163.com']) # 来自于哪里 msg['To'] = formataddr(["xxx", '316223167@qq.com']) # 发送于 msg['Subject'] = "Pytohn开发面试邀请" # 主题 server = smtplib.SMTP("smtp.163.com", 25) server.login("jassin_du@163.com", "xxx") # 邮箱 账户密码 server.sendmail('jassin_du@163.com', ['316223167@qq.com', ], msg.as_string()) server.quit()

 

posted @ 2018-06-04 20:37  小杜要加油  阅读(220)  评论(0编辑  收藏  举报