Python 发送邮件
作者:互联网
使用smtp.163.com 发送:
#!/usr/bin/env python
#-*- coding:utf8 -*-
import smtplib
from email.mime.text import MIMEText
def send_email():
mail_host = 'smtp.163.com'
mail_user = 'zhenningxxx'
mail_pwd = '12345678'
sender = 'zhenning@163.com'
receive = ['645924868@qq.com','shizhenning@126.com']
#text = "jin wan he jiu qu"
message = MIMEText('jin wan he jiu qu', 'plain', 'utf-8')
message['Subject'] = 'Meeting'
message['From'] = 'zhenning@163.com'
smtpobj = smtplib.SMTP()
smtpobj.connect(mail_host, 25)
smtpobj.login(mail_user,mail_pwd)
smtpobj.sendmail(sender,receive,message.as_string())
smtpobj.quit()
if __name__ == '__main__':
send_email()
标签:__,Python,发送,smtpobj,mail,message,com,email,邮件 来源: https://blog.51cto.com/magic3/2537147