Skip to content

Commit

Permalink
Merge pull request #1 from mboisson/master
Browse files Browse the repository at this point in the history
fixing starttls and calling it before login, otherwise it does not work
  • Loading branch information
pierky committed Feb 3, 2019
2 parents 611a92c + eb8c3cd commit ae30809
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pierky/buffered_smtp_handler/__init__.py
Expand Up @@ -81,7 +81,7 @@ def create_smtp(self):
return smtplib.SMTP(self.mailhost, self.mailport, None, self.timeout)

def starttls(self, smtp):
if self.secure:
if self.secure is not None:
smtp.starttls(*self.secure)
smtp.ehlo()

Expand All @@ -92,11 +92,10 @@ def flush(self):
try:
smtp = self.create_smtp()

self.starttls(smtp)
if self.smtp_username and self.smtp_password:
smtp.login(self.smtp_username, self.smtp_password)

self.starttls(smtp)

body = ""
for record in self.buffer:
s = self.format(record)
Expand Down

0 comments on commit ae30809

Please sign in to comment.