Page 1 of 1
Error sending e-mail: error handling file
Posted: Fri Sep 02, 2011 3:30 pm
by pedja
What this error means: "Error sending e-mail: error handling file"?
I have script that creates backup both command and binary. Command goes through email with no issues. For binary file I get this error.
Re: Error sending e-mail: error handling file
Posted: Fri Sep 02, 2011 4:07 pm
by mrz
to access backup files sensitive policy is required
Re: Error sending e-mail: error handling file
Posted: Fri Sep 02, 2011 5:53 pm
by pedja
Thanks, it works now. I guess this came with Mikrotik update, because the same script worked fine before.
Re: Error sending e-mail: error handling file
Posted: Mon Sep 05, 2011 8:58 am
by mrz
This behavior is since v4.x
Re: Error sending e-mail: error handling file
Posted: Wed Nov 14, 2012 3:34 pm
by lukkes
Hi,
i got the same error, the email can go fine when has no attachement, the snesitive policy is set, the debug log stucks in
RCV: 354 enter mail, end with "." on a line by itself,
error sending email, abnormal termination timeout
when i send the email without backup it works fine, also i try to send the backup in the /tool email, and stuck in the same place
thanks
Re: Error sending e-mail: error handling file
Posted: Tue Nov 04, 2014 5:04 pm
by bartjoo
Hello, i have the same problem:
sometimes it works, sometimes the logging says: Error sending e-mail <scriptname>: error handling file.
Is there someone who can explain whats happen?
/export file=([/system identity get name] . "-" . \
[:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6]); \
/tool e-mail send to="
x@X.nl" subject=([/system identity get name] . " Script " . \
[/system clock get date]) file=([/system identity get name] . "-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".rsc"); :delay 10; \
/file rem [/file find name=([/system identity get name] . "-" . [:pick [/system clock get date] 7 11] . \
[:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6] . ".rsc")]; \
:log info ("System Script emailed at " . [/sys cl get time] . " " . [/sys cl get date]);
Re: Error sending e-mail: error handling file
Posted: Wed Jun 08, 2016 12:39 am
by befree
the problem is here:
/export file="filename.rsc"
Create
filename.rsc.in_progress
(or similar, but not just filename.rsc).
-------------------------------------------------------------------------------------------------------
/tool e-mail file=filename.rsc
Try to get file
filename.rsc
BUT this file MAY BE still named with
.in_progress postfix.
-------------------------------------------------------------------------------------------------------
So, add
:delay 2s; before accessing this file:
/export file=filename.rsc
# wait export finished
:delay 2s;
/tool e-mail file=filename.rsc
Re: Error sending e-mail: error handling file
Posted: Mon Oct 02, 2017 10:53 am
by Lizzardd
I'm having a similar issue
I'm running my script as an "full" user
The script has sensitive policy enabled, yet I cannot get it to send the email with the file attached
:global BACKUPFILE [([/system identity get name] . "_" .[:pick [/system clock get date] 7 11] . [:pick [/system clock get date] 0 3] . [:pick [/system clock get date] 4 6])]
:global TO [("
email@gmail.com")]
:global SUBJECT [("[Mikrotik] ". [/system identity get name])]
:global BODY [("Backup file")]
/system backup save name=$BACKUPFILE
:delay 5
/tool e-mail send to=$TO subject=$SUBJECT body=$BODY file=$BACKUPFILE
:log info ("System Backup emailed at " . [/sys cl get time] . " " . [/sys cl get date])
:delay 10
/file remove $BACKUPFILE
name="EmailBackup" owner="owner"
policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive
last-started=oct/02/2017 09:52:36 run-count=105
Re: Error sending e-mail: error handling file
Posted: Wed Oct 04, 2017 3:17 pm
by servict
We got the same problem when sending e-mail with file attached its not sending.
Mail flow without file attached is working perfect.
Got the correct policy's enabled also, the logging show:
Error sending e-mail <[Mikrotik] cr2>: error handling file
Re: Error sending e-mail: error handling file
Posted: Tue Oct 10, 2017 4:05 pm
by Lizzardd
After doing some more digging around I found that if I specify the filename to use instead of using a variable, then I do not get the file handling error.
Could this be a bug in the OS?
Re: Error sending e-mail: error handling file
Posted: Tue Oct 10, 2017 4:18 pm
by Lizzardd
Find the solution
I changed the line
/tool e-mail send to=$TO subject=$SUBJECT body=$BODY file=$BACKUPFILE
to
/tool e-mail send to=$TO subject=$SUBJECT body=$BODY file=[$BACKUPFILE]
Just put the file variable in []
Re: Error sending e-mail: error handling file
Posted: Mon Oct 16, 2017 5:22 pm
by servict
This solution is still not working:
Error sending e-mail <[Mikrotik]>: error handling file
Re: Error sending e-mail: error handling file
Posted: Mon Feb 05, 2018 4:44 pm
by byte
Just add a little delay after the /tool email line
Re: Error sending e-mail: error handling file
Posted: Sun Jan 26, 2020 8:16 am
by jami
the problem is here:
/export file="filename.rsc"
Create
filename.rsc.in_progress
(or similar, but not just filename.rsc).
-------------------------------------------------------------------------------------------------------
/tool e-mail file=filename.rsc
Try to get file
filename.rsc
BUT this file MAY BE still named with
.in_progress postfix.
-------------------------------------------------------------------------------------------------------
So, add
:delay 2s; before accessing this file:
/export file=filename.rsc
# wait export finished
:delay 2s;
/tool e-mail file=filename.rsc
Adding delay work for me. Thanks
Re: Error sending e-mail: error handling file
Posted: Fri Oct 02, 2020 6:26 am
by jwalkerbg
This works for me:
/local filename ([/system identity get name] . "_" . [:pick [/system clock get date] 0 3] . "-" . [:pick [/system clock get date] 4 6] . "-" . [:pick [/system clock get date] 7 11] . ".rsc");
/export file=$filename;
:delay 5s;
/tool e-mail send to="support@mycompany.com" subject="$[/system identity get name] configuration export" \
body="Mikrotik $[/system identity get name]: configuration file on $[/system clock get date] - $[/system clock get time] --- $filename" \
file=$filename;
:delay 45s;
/file remove $filename;