Various Improvements and Changes #1
1 changed files with 2 additions and 1 deletions
|
@ -64,7 +64,8 @@ class EmailSender:
|
|||
smtp_server = smtplib.SMTP(self.hostname, port=self.port)
|
||||
context = ssl.create_default_context()
|
||||
smtp_server.starttls(context=context)
|
||||
smtp_server.login(self.username, self.password)
|
||||
if self.username != "" and self.password != "":
|
||||
smtp_server.login(self.username, self.password)
|
||||
smtp_server.send_message(message)
|
||||
except Exception as e:
|
||||
print(f'Unable to send mail through {self}: {e}')
|
||||
|
|
Loading…
Reference in a new issue