Logic Machine Forum
scripitng - 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: scripitng (/showthread.php?tid=5757)



scripitng - mariosp - 22.11.2024

hello i made this script i receive to error logs this ( User script:13: attempt to call field 'listen' (a nil value) stack tracebackSmilean anyone help me 

local smtp_server = 'logicmachine email'
local smtp_port = 587
local smtp_user = 'admin'
local smtp_pass = 'admin'
local recipient = 'mariospoulorinis@gmail.com'
local subject = 'Ειδοποίηση: Ενεργοποίηση αισθητήρα βροχής'
local message = 'Ομπρέλα να πάρεις'




event.listen(rain_sensor_ga, function(event)
  if value == true then 
    log
  ' email(smtp_server, smtp_port, smtp_user, smtp_pass, recipient, subject, message)'
   
  end
end)


RE: scripitng - Daniel - 22.11.2024

Please stop using chatGPT and search for examples on the forum.


RE: scripitng - mariosp - 22.11.2024

i tried this from the forum and it didnt work
value = event.getvalue()

to = 'test@test.com'
subject = 'Alert'
message = 'KNX object 1/2/2 value is: ' .. tostring(value)

res, err = mail(to, subject, message)

if not res then
  log(err)
end


RE: scripitng - Daniel - 22.11.2024

Did you setup, common functions with your email server settings?


RE: scripitng - mariosp - 22.11.2024

yes and i get this * string: 535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8 https://support.google.com/mail/?p=BadCredentials 5b1f17b1804b1-433b01e1030sm85985385e9.7 - gsmtp
but i cheked the username and the password


RE: scripitng - Daniel - 22.11.2024

See this
https://forum.logicmachine.net/showthread.php?tid=4076&pid=26361#pid26361


RE: scripitng - mariosp - 22.11.2024

now i get this
* string: host not found


RE: scripitng - Daniel - 22.11.2024

Check smpt server, seems it is wrong.