mirror of
https://github.com/Relintai/smtp_node.git
synced 2024-12-19 22:16:56 +01:00
Implement support for the SMTPS protocol.
This commit is contained in:
parent
94bbe7acb5
commit
d20b8d11f7
@ -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:
|
||||
@ -116,6 +117,30 @@ func open_socket():
|
||||
|
||||
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():
|
||||
|
Loading…
Reference in New Issue
Block a user