Skip to content

Commit

Permalink
fix smtp compatibility with python 3.12 (#54)
Browse files Browse the repository at this point in the history
* remove custom tls settings

* Update smtp.py
  • Loading branch information
WAKayser authored Nov 1, 2023
1 parent cfaf774 commit 054f090
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flask_mailman/backends/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ def open(self):
# TLS/SSL are mutually exclusive, so only attempt TLS over
# non-secure connections.
if not self.use_ssl and self.use_tls:
self.connection.starttls(keyfile=self.ssl_keyfile, certfile=self.ssl_certfile)
if self.ssl_certfile:
context = ssl.SSLContext().load_cert_chain(
self.ssl_certfile, keyfile=self.ssl_keyfile
)
else:
context = None
self.connection.starttls(context=context)
if self.username and self.password:
self.connection.login(self.username, self.password)
return True
Expand Down

0 comments on commit 054f090

Please sign in to comment.