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)

  

 

posted on 2020-12-22 20:11  风雨无阻!  阅读(70)  评论(0编辑  收藏  举报