I’m new to RouterOS and pretty new when it comes to the scripting part.
I’m having difficulties figuring out how i can assign command output to a local variable.
Lets say i want to receive /system resource print output as mail.
What i do is:
:local rescontent
:set rescontent [/system resource print as-value] #send email
/tool e-mail send to=“xxxxxxxxxxx@gmail.com” subject=([/system identity get name] . " System Resources " . [/system clock get date]) body=$rescontent tls=yes
But nothing happens. Can you tell me what am i doing wrong?
Thanks!
I can send mail to whatever address i like using the /tool e-mail send command. Mail servers and credentials are configured correctly. Thats not the problem.
If you are looking for only a specific resource instead of all of the output of /system resource print, it would require a bit more logic in the script to grab what you want.
Thanks a million!
That worked
But what about if I want to combine the output of two variables in the body of the e-mail message?
Specifying the first variable in the message is body=$rescontent but if i want to add another text output to the mail that is holded by another variable how can i add it alongside the first?