Community discussions

MikroTik App
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Fail command "parse" in script under V7.1

Fri Dec 10, 2021 7:42 pm

Hello,

I have a script (Email module) that I use to call from other scripts:

Script module: SendEmailFunction
# 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;
When I make the call to that module from other scripts:
# 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
Script result: "expected end of command (line 10 column 64)"

If I test that line from CLI:
:put [:parse [/system script  get SendEmailFunction source]]
# result: "expected end of command (line 10 column 64)"
Any help to get it to work on v7.1?

Best regards.

(sorry my bad english)
 
Sob
Forum Guru
Forum Guru
Posts: 9119
Joined: Mon Apr 20, 2009 9:11 pm

Re: Fail command "parse" in script under V7.1  [SOLVED]

Fri Dec 10, 2021 7:54 pm

It looks like there's no start-tls in v7. But there's tls=starttls.
 
User avatar
diamuxin
Member
Member
Topic Author
Posts: 319
Joined: Thu Sep 09, 2021 5:46 pm
Location: Alhambra's City

Re: Fail command "parse" in script under V7.1

Fri Dec 10, 2021 8:37 pm

It looks like there's no start-tls in v7. But there's tls=starttls.
Solved!!
Thank you so much.

Who is online

Users browsing this forum: No registered users and 27 guests