Improve error handling in send method by logging response on failure

This commit is contained in:
Edgar P. Burkhart 2025-05-17 21:39:40 +02:00
parent 6f336c17c0
commit 50af1527fb
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -189,9 +189,10 @@ class MicromailClient:
self.write(content + b"\r\n")
def send(self):
code, _ = self.send_command(b"\r\n.")
code, res = self.send_command(b"\r\n.")
if code != b"250":
print(f"Error: got code {code} on send")
print(res)
sys.exit(1)
print("Message sent successfully")