I have a script (Email module) that I use to call from other scripts:
Script module: SendEmailFunction
Code: Select all
# Variables
:local SendFrom "Router Mikrotik";
:local PasswordMail "MyStrongPassword";
:local SmtpServer 173.194.76.108;
:local UserName "my-user-gmail";
:local SmtpPort 587;
:local UseTLS "yes";
# Main script code
/tool e-mail send to=$SendTo server=$SmtpServer port=$SmtpPort start-tls=$UseTLS \
user=$UserName password=$PasswordMail from=$SendFrom subject=$Subject \
body=$TextMail file=$FileName;
Code: Select all
# START Send Email Module
:local SendTo "destination@gmail.com";
:local Subject "\F0\9F\9F\A2 $DeviceName [$Date $Time] New WAN IP.";
:local MessageText $Text;
:local FileName "";
:local SendEmail [:parse [/system script get SendEmailFunction source]];
$SendEmail SendTo=$SendTo TextMail=$MessageText Subject=$Subject FileName=$FileName;
# END Send Email Module
If I test that line from CLI:
Code: Select all
:put [:parse [/system script get SendEmailFunction source]]
# result: "expected end of command (line 10 column 64)"
Best regards.
(sorry my bad english)