Hello I’m trying to alter our existing netwatch on down event script to simply send an email to 5 recipients.
I’ve tried using a comma and or semi colon to separate each recipient.
Im using ROS v 3.30 Here’s my existing script code copied from netwatch down event window in winbox.
The first email address i altered to prevent webcrawlers from adding our support email.
the second email address is my personal account which im using strictly for testing.
When I try either email addresses by themselves it works by when i try adding any extra recipients it stops sending period.
I’m sure there is probably some syntax I’m missing for this to work .
Community please advise
Here is a more expandable / flexible approach you could try:
:local recipients { "abc@mycompany.com", \
"michael.manns@gmail.com", \
"another.email@domain.com" }
:local subject "Room 206 AP is down"
:foreach r in=[:toarray $recipients] do={
:put ("Sending email to " . [:tostr $r])
/tool e-mail send to=[:tostr $r] subject=[:tostr $subject]
}
As you need to add more recipients, just add their email to the list. Also, in the case of v4.6 where the tls= parameter changed, this allows you to maintain a single ‘/tool e-mail’ command syntax instead of many, making updates to the script very easy.
Hope this helps, just a bit of programming advise.
thank you for the info, Time for me to dissect the code you provided to try to understand the inner workings.
I’m driven to learn mikrotik api/scripting.
Why you can add multiple recipients for for CC and TO is strange. In normal email you can send to as meny TO users you like.
Also you need at list on TO user, also strange. Only CC should be enough as well.
Here MT has some work to do.