首页 > 编程语言 > 详细

python send email

时间:2020-12-22 22:15:41      阅读:44      评论:0      收藏:0      [点我收藏+]
import smtplib
from email.mime.text import MIMEText

from_address = ‘xxx@huawei.com‘
to_address = ‘xxx@huawei.com‘
msg = MIMEText(‘Hello, send by Python...‘, ‘plain‘, ‘utf-8‘)
msg[‘Subject‘] = ‘标题‘
smtp_server = ‘smtp.huawei.com‘
server = smtplib.SMTP(smtp_server)
server.set_debuglevel(1)
server.login(‘username‘, ‘password‘)
server.sendmail(from_addr=from_address, to_addrs=to_address, msg=msg.as_string())
server.quit()

print(‘email send success!(%s)‘ % to_address)

  

 

python send email

原文:https://www.cnblogs.com/hello-python2020/p/14174993.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!