Logic Machine Forum
how to Check email - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: how to Check email (/showthread.php?tid=3523)



how to Check email - khalil - 24.08.2021

hello 
I have a user who asked to receive alarms by email and everything was alright and an email was sent.
after they add a firewall, I can access the remote via ETS, and the email stops sending!
is there a way to check that its a firewall issue 
I am using SL V2.6.1 

regards,


RE: how to Check email - Daniel - 24.08.2021

Try running this script, change server and port accordingly to yours.

Code:
function checktcp(ip, port)
  local sock = require('socket').tcp()
  sock:settimeout(1)
  local res, err = sock:connect(ip, port)
  sock:close()
  return res, err
end

-- change IP/PORT as needed
res, err = checktcp('smtp.gmail.com', 465)
if res then
  log('connect OK')
else
  log('connect ERROR', err)
end



RE: how to Check email - khalil - 24.08.2021

(24.08.2021, 13:20)Daniel. Wrote: Try running this script, change server and port accordingly to yours.

Code:
function checktcp(ip, port)
  local sock = require('socket').tcp()
  sock:settimeout(1)
  local res, err = sock:connect(ip, port)
  sock:close()
  return res, err
end

-- change IP/PORT as needed
res, err = checktcp('smtp.gmail.com', 465)
if res then
  log('connect OK')
else
  log('connect ERROR', err)
end

thanks, Daniel
I got this in the log: 


* arg: 1
  * string: connect ERROR
* arg: 2
  * string: Host is unreachable


so its firewall issue


RE: how to Check email - Daniel - 24.08.2021

It looks like yes