Fix STARTTLS handling and improve logging in MicromailClient
This commit is contained in:
parent
8487456da1
commit
6f336c17c0
1 changed files with 5 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue