Fix: Email error. (#6701)

### What problem does this PR solve?

#6695

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2025-04-01 10:37:04 +08:00 committed by GitHub
parent 67330833af
commit 61c0dfab70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,7 +82,10 @@ class Email(ComponentBase, ABC):
logging.info(f"Connecting to SMTP server {self._param.smtp_server}:{self._param.smtp_port}")
context = smtplib.ssl.create_default_context()
with smtplib.SMTP_SSL(self._param.smtp_server, self._param.smtp_port, context=context) as server:
with smtplib.SMTP(self._param.smtp_server, self._param.smtp_port) as server:
server.ehlo()
server.starttls(context=context)
server.ehlo()
# Login
logging.info(f"Attempting to login with email: {self._param.email}")
server.login(self._param.email, self._param.password)