From 6f336c17c087e901b664660306377988bae4882e Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sat, 17 May 2025 21:35:50 +0200 Subject: [PATCH] Fix STARTTLS handling and improve logging in MicromailClient --- micromail.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/micromail.py b/micromail.py index 0a5973b..4fd5a00 100644 --- a/micromail.py +++ b/micromail.py @@ -58,9 +58,10 @@ class MicromailClient: sys.exit(1) self.features = self.ehlo() + print(self.features) - if self.starttls and "STARTTLS" in self.features: - self.starttls() + if self.starttls and b"STARTTLS" in self.features: + self.start_starttls() def login(self, username, password): self.username = username @@ -122,12 +123,13 @@ class MicromailClient: sys.exit(1) return res - def starttls(self): + def start_starttls(self): code, res = self.send_command(b"STARTTLS") if code != b"220": print(f"Error: got code {code} on STARTTLS") sys.exit(1) + print(res) self.socket = ssl.wrap_socket(self.socket) def new_message(self, to, sender=None):