diff --git a/SendEmail.py b/SendEmail.py index 600be9c..eba2382 100644 --- a/SendEmail.py +++ b/SendEmail.py @@ -11,7 +11,7 @@ # 第三方 SMTP 服务 mail_host = "smtp.sina.com" # 设置服务器 mail_user = "ang101888@sina.com" # 用户名 - mail_pass = "bc5bfc5377295e39" # 口令 + mail_pass = "6da1c01736769990" # 口令 sender = 'Warning' receivers = ['belloving@qq.com'] # 接收邮件,可设置为你的QQ邮箱或者其他邮箱 message = MIMEText(traceback.format_exc(), 'plain', 'utf-8') # traceback.format_exc()为报错日志 @@ -20,7 +20,8 @@ message['Subject'] = 'EastMoney-Project' try: - smtpObj = smtplib.SMTP(mail_host, 25) # 25 为 SMTP 端口号 + # smtpObj = smtplib.SMTP(mail_host, 25) # 25 为 SMTP 端口号 + smtpObj = smtplib.SMTP_SSL(mail_host, 465) # 25 为 SMTP 端口号 smtpObj.login(mail_user, mail_pass) smtpObj.sendmail(sender, receivers, message.as_string()) print('邮件发送成功')