Community discussions

MUM Europe 2020
 
pepelxl
just joined
Topic Author
Posts: 13
Joined: Tue Jul 23, 2013 6:59 pm

status of the sent email?

Fri Jul 19, 2019 4:45 pm

Is it possible to check the status of the sent email?
Learn the script execution status, example:
/tool e-mail send to=exemple@mail.ru subject="Mikrotik" body=hello
:if (email send....) do=
 
User avatar
eworm
Member
Member
Posts: 423
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: status of the sent email?  [SOLVED]

Sat Jul 20, 2019 12:19 am

:if ([ /tool e-mail get last-status ] = "succeeded") do={ ...
But I am not sure if you need a delay between sending and checking for status...
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts
 
pepelxl
just joined
Topic Author
Posts: 13
Joined: Tue Jul 23, 2013 6:59 pm

Re: status of the sent email?

Sat Jul 20, 2019 8:03 am

Thanks you.
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 219
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: status of the sent email?

Mon Dec 02, 2019 8:24 pm

With waiting loop until "in-progress" will change.
{
# Wait until other script in bg end sending e-mail now...
while ([tool e-mail get last-status] = "in-progress") do={delay 1s}
delay 2s

# Now I send my e-mail who has wrong smtp server and reach timeout...
tool e-mail send server=1.1.1.1 subject="WrongSMTP" to=name@domain.tld
while ([tool e-mail get last-status] = "in-progress") do={delay 1s}
local EMailStatus [tool e-mail get last-status]
if ($EMailStatus = "failed") do={put "ERROR"}
if ($EMailStatus = "succeeded") do={put "SUCCESS"}
}
OR
{
tool e-mail send server=1.1.1.1 subject="WrongSMTP" to=name@domain.tld
local ExitDoLoop false
while ($ExitDoLoop = false) do={
  local EMailStatus [tool e-mail get last-status];
  if ($EMailStatus = "in-progress") do={delay 1s; put "."} else={
    set $ExitDoLoop true;
    if ($EMailStatus = "failed") do={put "ERROR"}
    if ($EMailStatus = "succeeded") do={put "SUCCESS"}
  }
}
}
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software

Who is online

Users browsing this forum: No registered users and 7 guests