python STMP

Posted Adam_LBQ

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python STMP相关的知识,希望对你有一定的参考价值。

import smtplib
from email.header import Header
from email.mime.text import MIMEText
server = smtplib.SMTP(‘smtp.163.com‘, 25)
server.login(‘[email protected]‘, ‘LBQ139196‘)
msg = MIMEText(‘hello, send by Python...‘, ‘plain‘, ‘utf-8‘)
msg[‘From‘] = ‘[email protected] <[email protected]>‘
msg[‘Subject‘] = Header(u‘text‘, ‘utf8‘).encode()
msg[‘To‘] = u‘飞轮海 <[email protected]>‘
server.sendmail(‘[email protected]‘, [‘[email protected]‘], msg.as_string())

  

以上是关于python STMP的主要内容,如果未能解决你的问题,请参考以下文章