Update SMTP-NodeCode

This commit is contained in:
AriWD40 2020-07-25 18:05:35 +00:00 committed by GitHub
parent 17efd81f0e
commit befd11d5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,23 +1,5 @@
extends Node extends Node
###########################################################
#
# ExtraSimple SMTP client
#
# 1 - import in your project
# 2 - put values in var server, user, password,
# mailto, mymail
# 3 - call method Deliver(data) to send mail
#
###########################################################
###########################################################
#
#
# d: inner class for simple debug - begin
#
#
###########################################################
var debug = true var debug = true
@ -25,15 +7,6 @@ func display(data):
if debug == true: if debug == true:
print("debug: ",data) print("debug: ",data)
###########################################################
#
#
# d: inner class for simple debug - end
#
#
###########################################################
export var server = "smtp.gmail.com" export var server = "smtp.gmail.com"
export var port = 465 # standard SSL port export var port = 465 # standard SSL port
export var user = ""# # put userid for SMTP login export var user = ""# # put userid for SMTP login
@ -41,32 +14,9 @@ export var password = "" # put password for SMTP login
export var mymailto = "" # put destination address export var mymailto = "" # put destination address
export var mymail = "mail.smtp.localhost" export var mymail = "mail.smtp.localhost"
###########################################################
#
# signals
#
###########################################################
signal SMTP_connecting
signal SMTP_connected
signal SMTP_working
signal SMTP_disconnected_error
signal SMTP_disconnected_ok
###########################################################
#
# method used to connect
#
###########################################################
enum channel {TCP,PACKET} enum channel {TCP,PACKET}
export (channel) var com = channel.TCP export (channel) var com = channel.TCP
###########################################################
#
# storage area
#
###########################################################
var authloginbase64="" var authloginbase64=""
var authpassbase64="" var authpassbase64=""
@ -81,7 +31,7 @@ enum esi {OK,KO}
enum stati {OK,WAITING,NO_RESPONSE,UNHANDLED_REPONSE} enum stati {OK,WAITING,NO_RESPONSE,UNHANDLED_REPONSE}
export (stati) var stato export (stati) var stato
var MaxRetries = 30 var MaxRetries = 5
var delayTime = 250 var delayTime = 250
var thread = null var thread = null
@ -134,6 +84,9 @@ var Bocket = null
# I added the variable Bocket, as a wrap around the Socket (originally called socket anyway), # I added the variable Bocket, as a wrap around the Socket (originally called socket anyway),
# it's an SSL wrapper for Streampeers, I don't know much about these things, # it's an SSL wrapper for Streampeers, I don't know much about these things,
# but you learn a lot by messing around with things. # but you learn a lot by messing around with things.
# I like creating silly names for variables, it keeps me motivated,
# reminds me that creating code is my choice, to do how I please.
func OpenSocket(): func OpenSocket():
var error var error
@ -144,7 +97,6 @@ func OpenSocket():
Socket = StreamPeerSSL.new() Socket = StreamPeerSSL.new()
Socket.connect_to_stream(Bocket, true, server) Socket.connect_to_stream(Bocket, true, server)
display(["connecting server...",server,error]) display(["connecting server...",server,error])
if error > 0: if error > 0: