![]() |
e-mail triggering - 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: e-mail triggering (/showthread.php?tid=3330) |
e-mail triggering - RafalBor - 29.04.2021 Hi, I'm trying to trigger sending mail by value =1. would that be correct script? -- make sure mail settings are set in user function library before using this function subject = 'THERE IS ALARM' message = 'THERE IS AN ALARM IN THE SYSTEM- PLEASE LOG IN TO VISUALISATION AND CHECK ALARM PAGE' mail('test@mail.com', subject, message) --trigger function value = event.getvalue() if (value ==1) then send (mail) end RE: e-mail triggering - admin - 29.04.2021 For boolean data type the value can be either true or false. You can simply write it like this: Code: value = event.getvalue() RE: e-mail triggering - RafalBor - 29.04.2021 Hi, I've set as advised and made sure the object in of the boolean type, but no e-mail is being sent. The whole trigger even looks like this: -- make sure mail settings are set in user function library before using this function subject = 'THERE IS ALARM' message = 'THERE IS AN ALARM IN THE SYSTEM- PLEASE LOG IN TO VISUALISATION AND CHECK ALARM PAGE' mail('mail to which e send', subject, message) --trigger function value = event.getvalue() if value then send (mail) end RE: e-mail triggering - admin - 29.04.2021 Change to variable as needed. If it does not work then check what you get in Logs tab. Code: to = 'user@example.com' RE: e-mail triggering - RafalBor - 29.04.2021 That's the fault from logs: * arg: 1 * nil * arg: 2 * string: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials o1sm5514363wrm.66 - gsmtp less secure apps are activated - just in case you might ask RE: e-mail triggering - Daniel - 29.04.2021 Did you setup email settings in Common functions? RE: e-mail triggering - RafalBor - 29.04.2021 I've got it working - just retyped all instead copy paste and is working Now, one more question - if I wished to have more users then what would I need to do? add more mail addresses in the line 'to' i.e. to = 'user1@mail.com' ; 'user2@mail.com' RE: e-mail triggering - admin - 29.04.2021 Like this: Code: to = { 'user1@mail.com', 'user2@mail.com' } |