From e3b4085552741b43ee81b4c5d5abeea08617f504 Mon Sep 17 00:00:00 2001 From: cyy_mac Date: Tue, 24 Mar 2026 23:02:28 +0800 Subject: [PATCH] fix 25 port no reach /. problem --- notifier.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/notifier.py b/notifier.py index 43e1f24..251a02d 100644 --- a/notifier.py +++ b/notifier.py @@ -19,6 +19,7 @@ class EmailNotifier: self.smtp_password = config['smtp_password'] self.to_email = config['to_email'] self.use_tls = config.get('use_tls', True) + self.use_ssl = config.get('use_ssl', False) def send(self, notifications): """发送邮件通知""" @@ -39,9 +40,12 @@ class EmailNotifier: msg.attach(MIMEText(html_body, 'html', 'utf-8')) try: - server = smtplib.SMTP(self.smtp_host, self.smtp_port) - if self.use_tls: - server.starttls() + if self.use_ssl: + server = smtplib.SMTP_SSL(self.smtp_host, self.smtp_port) + else: + server = smtplib.SMTP(self.smtp_host, self.smtp_port) + if self.use_tls: + server.starttls() server.login(self.smtp_user, self.smtp_password) server.send_message(msg) server.quit()