#Backup_send-mail V.1.0 [20130330]
:local mailsender ([/system identity get name]."@domain.com");
:local mailrec *your.email@domain.com*;
:local mailpass *mailpassword*;
:local mailbody "B.A.C.K.U.P.";
:local mailserver [:resolve *your-mailserver.domain.com*];
:local mailuser *user@domain.com*;
:local mailsubject ("Backup from /".[/system identity get name]."/".[/system clock get date]."/".[/system clock get time]);
:local backupfile ([/system identity get name].".backup");
/system backup save name=[/system identity get name];
:log info "----- Backup Created";
:delay 1000ms;
/tool e-mail send from=$mailsender to=$mailrec subject=$mailsubject body=$mailbody server=$mailserver user=$mailuser password=$mailpass file=$backupfile;
:log info "----- Backup Sent to $mailrec";
replace:
your.email@domain.com.. - with receivers mail address (without “*”) your-mailserver.domain.com - with name of mailserver that will send the mail user@domain.com - with username to log on to the mailserver mailpassword - with password used to logon to the mailserver
I tried to send backup file manual, and I went to System > Email
and I make attach for file backup
and it give me same message
I notice all the script work good , but when it arrived to load backup file to attached , it show the message
I thought because size of backup file, but the size is 800kb
your Script for Mikrotik System backup
and My Script for user manger bakup
as I said before the problem not in the Script
because I saw the log , and it is work very good
but when it arrived to load backup user manger , to attached to my email
It failed , I don’t know what the reason?
Sending e-mail used to work up to and including RouterOS 6.25. My last backup via e-mail is from feb/02/2015.
I updated to RouterOS on feb/04/2015. After that I did not receive a mail from my routerboards.
Mar 02 10:37:02 mx postfix/smtpd[16003]: connect from unknown[xx.xx.xx.xx]
Mar 02 10:37:02 mx postfix/smtpd[16003]: disconnect from unknown[xx.xx.xx.xx]
At least in my test configuration exact same script is working correctly:
Is this command executed:
*) Through console;
*) Through Script running it form console;
*) Through Script running it by pressing button in Winbox;
*) Through Script running it by Scheduler?
What is the size of attached file?
What kind of policy options are enabled if command is executed from Script?
What kind of policy options are enabled if command is executed from Scheduler?
A SMTP server that is not publicly referenced may choose to require
that the client perform a TLS negotiation before accepting any
commands. In this case, the server SHOULD return the reply code:
530 Must issue a STARTTLS command first
to every command other than NOOP, EHLO, STARTTLS, or QUIT.
If the client and server are using the ENHANCEDSTATUSCODES
ESMTP extension [RFC2034], the status code to be returned
SHOULD be 5.7.0.
Maybe the problem is that you try to connect to the submission port (587) which does not allow other commands than those referenced in RFC 3207.
Please try to connect using port 25 on.
But, anyway, RouterOS should work using port 587 also.
A SMTP server that is not publicly referenced may choose to require
that the client perform a TLS negotiation before accepting any
commands. In this case, the server SHOULD return the reply code:
530 Must issue a STARTTLS command first
to every command other than NOOP, EHLO, STARTTLS, or QUIT.
If the client and server are using the ENHANCEDSTATUSCODES
ESMTP extension [RFC2034], the status code to be returned
SHOULD be 5.7.0.
Maybe the problem is that you try to connect to the submission port (587) which does not allow other commands than those referenced in RFC 3207.
Please try to connect using port 25 on.
But, anyway, RouterOS should work using port 587 also.
Thank you, version 6.28 did correct the short smtp connection timeout problem. However, other short timeouts now exist within the communication session. On high latency connections (or those with intentional anti-spam post-connection delays), if RouterOS 's e-mail tool does not receive a reply within 15 seconds, it will abort the session without generating any error message or attempting a retry. This specific problem only popped up in 6.28.
A 15 second response delay appears to be enough to trigger the behavior. This can be duplicated by configuring a Postfix based mail server using the “sleep” directive. For example the e-mail tool will drop out (without generating syslog error messages) after sending “RCPT TO:” with the remote Postfix mail server configured as follows:
This is not a critical problem (since removing the sleep line resolves the problem); however, it does introduce a new, undesirable behavior. Increasing the time-out or adding a debug syslog event would be most useful.
Thanks again for fixing the original connection timeout bug