import smtplib
from email.mime.text import MIMEText
title = "request build error"
content = "request build error"
to_address = ["[email protected]"]
def send_email(username, passwd, recv, title, content, email_host="hwsmtp.exmail.qq.com", port=25):
msg = MIMEText(content)
msg["from"] = "menghui"
msg["Subject"] = title
smtp = smtplib.SMTP(host=email_host, port=port, timeout=120)
smtp.login(username, passwd)
smtp.set_debuglevel(1)
smtp.sendmail(username, recv, msg.as_string())
smtp.quit()
def send(title, content, to_address):
email_user = "[email protected]"
email_pwd = "Mobvista123"
send_email(email_user, email_pwd, to_address, title, content)
if __name__ == "__main__":
send(title, content, to_address)
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/17084.html