This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Send e-mail
#1
Hello,
I needed to send an email when an event with a group address occurs. Does anyone have an example?
Reply
#2
Hi,

Just use the build in mail function and trigger it as event based script:
Code:
1234
-- make sure mail settings are set in common functions library before using this function subject = 'E-mail test' message = 'Testing e-mail' mail('user@example.com', subject, message)
BR,

Erwin
Reply
#3
Thanks
Reply
#4
Hello,
I need to send a value from storage by email, someone has an example?
Reply
#5
For event value you can use an event script:
Code:
12345
value = event.getvalue() subject = 'E-mail test' message = 'Event value is ' .. tostring(value) mail('user@example.com', subject, message)

For storage value you need a scheduled script. But, if you want to send a value on each storage value change you should use a virtual object instead because you cannot attach an event script to storage changes.
Code:
12345
value = storage.get('myvalue') subject = 'E-mail test' message = 'Storage value is ' .. tostring(value) mail('user@example.com', subject, message)
Reply
#6
Thank you very much
Reply
#7
Hello guys!
A little bit of help here..

I have cycling send from a GA that comes from a generator. Can we adjust the code to send the email only if the GA changes it’s state. So an email with subject ‘Generator On’ will be sent when the GA is 1 and an email with subject ‘Generator Off’ will be sent when the GA is 0.

Thank you in advance!!
Reply
#8
Something like that would do, event script
Code:
123456789101112131415
value = event.getvalue() mydata = storage.get('myobjectdata', 2) if value then   if value ~= mydata then     --emial for on   end else     if value ~= mydata then    --email for off   end end  storage.set('myobjectdata', value)
------------------------------
Ctrl+F5
Reply
#9
As always… your script works like a charm!!!!
Thank you very much!!
Reply


Forum Jump: