From d20b8d11f7f683a27676e89ea5582d4d417fb5b9 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 18 Sep 2023 13:47:21 +0200 Subject: [PATCH] Implement support for the SMTPS protocol. --- SMTPClient.gd | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/SMTPClient.gd b/SMTPClient.gd index d7e761d..fd99dc1 100644 --- a/SMTPClient.gd +++ b/SMTPClient.gd @@ -54,6 +54,7 @@ func _thread_deliver(user_data): var r_code : int r_code = open_socket() + if r_code == OK: r_code = wait_answer() # if r_code == OK: @@ -115,7 +116,31 @@ func open_socket(): break OS.delay_msec(delay_time) + + if auth_type == AuthType.SMTPS: + _socket_original = _socket + _socket = StreamPeerSSL.new() + _socket.connect_to_stream(_socket_original, true, server) + + for i in range(max_retries): + print("TLS RETRIES" + str(_socket.get_status())) + + if _socket.get_status() == _socket.STATUS_ERROR: + display("Error while requesting connection") + return _socket.get_status() + + # elif _socket.get_status() == _socket.STATUS_CONNECTING: + # d.display("connecting...") + # break + + if _socket.get_status() == _socket.STATUS_CONNECTED: + display("TLS connection up") + print("TLS CONNECTED") + break + + OS.delay_msec(delay_time) + return error func close_socket():