Skip to content

Commit

Permalink
chg: [MailExporter] debug: add EHLO
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrtia committed Feb 24, 2025
1 parent d81c550 commit eaf56d5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bin/exporter/MailExporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ def __init__(self, host=None, port=None, password=None, user='', sender='', cert

def get_smtp_client(self):
# try:
smtp_server = smtplib.SMTP(self.host, self.port)
if self.pw is not None:
try:
smtp_server = smtplib.SMTP(self.host, self.port)
smtp_server.ehlo()
smtp_server.starttls()
except smtplib.SMTPNotSupportedError:
self.logger.info(f"The server {self.host}:{self.port} does not support the STARTTLS extension.")
Expand All @@ -97,8 +98,6 @@ def get_smtp_client(self):
smtp_server.login(self.user, self.pw)
else:
smtp_server.login(self.sender, self.pw)
else:
smtp_server = smtplib.SMTP(self.host, self.port)
return smtp_server
# except Exception as err:
# traceback.print_tb(err.__traceback__)
Expand Down

0 comments on commit eaf56d5

Please sign in to comment.