SMTP authentication is optional (#2765)

Co-authored-by: Laurent Magnien <laurent.magnien@adsn.fr>
This commit is contained in:
Laurent Magnien
2024-03-09 02:11:03 +01:00
committed by GitHub
parent ce58f0607b
commit bdc13f9238
2 changed files with 2 additions and 3 deletions

View File

@@ -16,7 +16,8 @@ class SMTPClient:
smtp = smtplib.SMTP(self.server, self.port)
if self._use_tls:
smtp.starttls()
smtp.login(self.username, self.password)
if (self.username):
smtp.login(self.username, self.password)
msg = MIMEMultipart()
msg['Subject'] = mail['subject']
msg['From'] = self._from