1
0
mirror of https://github.com/eworm-de/routeros-scripts.git synced 2024-05-11 05:55:19 +00:00

global-functions: $FlushEmailQueue: do not flush with resolver issues

Flushing the mail queue with resolver issues can flood the log with
messages like:

e-mail;error Error sending e-mail <=?utf-8?Q?[MikroTik] =F0=9F=92=BE=E2=98=81 Cloud backup?=>: DNS resolve failed

Try to avoid this...
This commit is contained in:
Christian Hesse
2022-09-15 21:49:06 +02:00
parent 220dd8f892
commit f245751339

View File

@ -323,6 +323,7 @@
:global EmailQueue; :global EmailQueue;
:global EitherOr; :global EitherOr;
:global IsDNSResolving;
:global IsTimeSync; :global IsTimeSync;
:global LogPrintExit2; :global LogPrintExit2;
@ -334,6 +335,11 @@
:return false; :return false;
} }
:if ([ :typeof [ :toip [ /tool/e-mail/get address ] ] ] != "ip" && [ $IsDNSResolving ] = false) do={
$LogPrintExit2 debug $0 ("Server address is a DNS name and resolving fails, not flushing.") false;
:return false;
}
:if ([ :len [ /system/scheduler/find where name="FlushEmailQueue" ] ] > 0 && $QueueLen = 0) do={ :if ([ :len [ /system/scheduler/find where name="FlushEmailQueue" ] ] > 0 && $QueueLen = 0) do={
$LogPrintExit2 warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.") false; $LogPrintExit2 warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.") false;
} }