Logic Machine Forum
Change of IP without notification of mail! - 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: Change of IP without notification of mail! (/showthread.php?tid=2482)



Change of IP without notification of mail! - phongvucba - 20.02.2020

Hi everybody !
I have the following code:
----------------------------------
require('user.mail')
require('socket.http')
socket.http.timeout = 0
http = require('socket.http')
local ip = http.request('http://openrb.com/ip')
local oldip= storage.get('myip')
if (ip~=nil and ip ~= oldip) then
  log("Change my ip=" .. ip ) 
  storage.set('myip', ip)
  mail('panhhvtc@gmail.com','Ctr nha mau 66 ngo thi nham ','IP : '..ip)
end
-----------------------------------
The above code when I ran, it reported an error as shown in the attached image. What is wrong with me? My Gmail is still working fine
Thank so much ! Smile


RE: Change of IP without notification of mail! - Daniel - 20.02.2020

what FW do you use?


RE: Change of IP without notification of mail! - admin - 20.02.2020

Use HTTPS. If it still does not work then you have to update firmware to 2019 RC1.
Code:
require('user.mail')
ip = require('ssl.https').request('https://openrb.com/ip')
oldip = storage.get('myip')
if ip and ip ~= oldip then
  log('Change my ip=' .. ip)
  storage.set('myip', ip)
  mail('panhhvtc@gmail.com','Ctr nha mau 66 ngo thi nham ','IP : '..ip)
end