Community discussions

MikroTik App
 
pedja
Long time Member
Long time Member
Topic Author
Posts: 684
Joined: Sat Feb 26, 2005 5:37 am

Error sending e-mail: error handling file

Fri Sep 02, 2011 3:30 pm

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.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7054
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Error sending e-mail: error handling file

Fri Sep 02, 2011 4:07 pm

to access backup files sensitive policy is required
 
pedja
Long time Member
Long time Member
Topic Author
Posts: 684
Joined: Sat Feb 26, 2005 5:37 am

Re: Error sending e-mail: error handling file

Fri Sep 02, 2011 5:53 pm

Thanks, it works now. I guess this came with Mikrotik update, because the same script worked fine before.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7054
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Error sending e-mail: error handling file

Mon Sep 05, 2011 8:58 am

This behavior is since v4.x
 
lukkes
Member Candidate
Member Candidate
Posts: 177
Joined: Mon Jun 16, 2008 2:12 am
Location: Venezuela
Contact:

Re: Error sending e-mail: error handling file

Wed Nov 14, 2012 3:34 pm

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
 
bartjoo
Frequent Visitor
Frequent Visitor
Posts: 63
Joined: Tue Apr 09, 2013 5:56 pm

Re: Error sending e-mail: error handling file

Tue Nov 04, 2014 5:04 pm

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]);
 
befree
just joined
Posts: 3
Joined: Wed Jan 15, 2014 3:53 pm
Location: Saint-Petersburg, Russia

Re: Error sending e-mail: error handling file

Wed Jun 08, 2016 12:39 am

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
 
Lizzardd
newbie
Posts: 27
Joined: Wed Jan 04, 2012 11:56 am

Re: Error sending e-mail: error handling file

Mon Oct 02, 2017 10:53 am

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
 
servict
just joined
Posts: 3
Joined: Wed Aug 30, 2017 2:29 pm

Re: Error sending e-mail: error handling file

Wed Oct 04, 2017 3:17 pm

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
 
Lizzardd
newbie
Posts: 27
Joined: Wed Jan 04, 2012 11:56 am

Re: Error sending e-mail: error handling file

Tue Oct 10, 2017 4:05 pm

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?
 
Lizzardd
newbie
Posts: 27
Joined: Wed Jan 04, 2012 11:56 am

Re: Error sending e-mail: error handling file

Tue Oct 10, 2017 4:18 pm

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 []
 
servict
just joined
Posts: 3
Joined: Wed Aug 30, 2017 2:29 pm

Re: Error sending e-mail: error handling file

Mon Oct 16, 2017 5:22 pm

This solution is still not working:


Error sending e-mail <[Mikrotik]>: error handling file
 
byte
just joined
Posts: 3
Joined: Mon Feb 05, 2018 4:40 pm

Re: Error sending e-mail: error handling file

Mon Feb 05, 2018 4:44 pm

Just add a little delay after the /tool email line
 
jami
just joined
Posts: 6
Joined: Fri Jun 01, 2007 5:40 am

Re: Error sending e-mail: error handling file

Sun Jan 26, 2020 8:16 am

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
 
jwalkerbg
just joined
Posts: 3
Joined: Mon May 18, 2020 10:01 am
Location: Bulgaria

Re: Error sending e-mail: error handling file

Fri Oct 02, 2020 6:26 am

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;

Who is online

Users browsing this forum: anav and 90 guests