2024-09-01
Python
00

Python

handlebars
# -*- coding: utf-8 -*- import smtplib from email.mime.text import MIMEText from email.header import Header def send_email_to_d(mesg, receivers=['[email protected]', '[email protected]']): # 第三方 SMTP 服务 mail_host = "smtp.exmail.qq.com" # 设置服务器 mail_user = "[email protected]" # 用户名 mail_pass = "43123131" # 口令 密码 sender = '[email protected]' message = MIMEText(mesg, 'plain', 'utf-8') message['From'] = Header("kes", 'utf-8') message['To'] = Header("dyl", 'utf-8') subject = '数据库报错' message['Subject'] = Header(subject, 'utf-8') try: smtpObj = smtplib.SMTP_SSL(mail_host, 465) smtpObj.login(mail_user, mail_pass) smtpObj.sendmail(sender, receivers, message.as_string()) smtpObj.quit() print("邮件发送成功") except smtplib.SMTPException: print("Error: 无法发送邮件")
如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:Dong

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!