smtplib

import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr

# ### 1.邮件内容配置 ###
msg = MIMEText("python", 'html', 'utf-8')
msg['From'] = formataddr(["武沛齐", "yangliangran@126.com"])
msg['Subject'] = "路飞学城"

# ### 2.发送邮件 ###
server = smtplib.SMTP_SSL("smtp.126.com")
server.login("yangliangran@126.com", "LAYEVIAPWQAVVDEP")
server.sendmail("yangliangran@126.com", "343096080@qq.com", msg.as_string())
server.quit()
View Code

 

import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr

# ### 1.邮件内容配置 ###
msg = MIMEText("hi", 'html', 'utf-8')
msg['From'] = formataddr(["bubu", "yesido20060505@163.com"])
msg['Subject'] = "hello"

# ### 2.发送邮件 ###
server = smtplib.SMTP_SSL("smtp.163.com")
server.login("yesido20060505@163.com", "YINKMSEWGDYYQTSL")
server.sendmail("yesido20060505@163.com", "343096080@qq.com", msg.as_string())
server.quit()
View Code

 

posted @ 2020-05-27 02:50  silencio。  阅读(130)  评论(0编辑  收藏  举报