美文网首页
python邮件发送

python邮件发送

作者: tglmm | 来源:发表于2020-02-04 12:04 被阅读0次
import smtplib

from email.mime.text import MIMEText

SMTPServer = "smtp.163.com"

sender = "xxxx@163.com"
passwd = "123456"

receiver= "yyyy@163.com"

messages = "the server 10.0.1.1 is down"

msg = MIMEText(messages)

#this is a theam
msg["Subject"] = "test"
#sender
msg["From"] = sender

mailServer = smtplib.SMTP(SMTPServer,25)
mailServer.login(sender,passwd)
mailServer.sendmail(sender,[receiver,'112345@qq.com','123456@qq.com'],msg.as_string())

mailServer.quit()

相关文章

网友评论

      本文标题:python邮件发送

      本文链接:https://www.haomeiwen.com/subject/pqlrxhtx.html