I use the following, is working well for me.

/tool e-mail
set address=XX.XX.XX.XX from=MikroTik<[email protected]> 
last-status=succeeded

/system script
add name=auto-backup policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive \
    source="# delete previous auto backup files\r\
    \n#\r\
    \n:foreach i in=[/file find] do={\r\
    \n    :local name [/file get \$i name]\r\
    \n    :if ([:pick \$name 0 12] = \"auto-backup.\") do={\r\
    \n          :log info \"Deleting file \$name\"\r\
    \n          /file remove \$i\r\
    \n          }\r\
    \n    }\r\
    \n#\r\
    \n# assemble current file name\r\
    \n#\r\
    \n:global curdt [/system clock get date]\r\
    \n:global newdt (\"\$[:pick \$curdt 7 11]-\$[:pick \$curdt 0 3]-\$[:pick \
    \$curdt 4 6]\")\r\
    \n:global curtm [/system clock get time]\r\
    \n:global newtm (\"\$[:pick \$curtm 0 2]\$[:pick \$curtm 3 5]\$[:pick \$cu\
    rtm 6 8]\")\r\
    \n:global subject (\"of \$[/system identity get name] (\$[/system routerbo\
    ard get model])\")\r\
    \n:global filename (\"auto-backup.\$[/system identity get name].\$newdt-\$\
    newtm\")\r\
    \n#\r\
    \n# do the backup\r\
    \n#\r\
    \n:log info \"Creating \$filename.rsc and \$filename.backup\"\r\
    \n/export compact file=\$filename\r\
    \n/system backup save name=\$filename\r\
    \n:delay 15s\r\
    \n/tool e-mail send file=\"\$filename.rsc\" 
to=\"[email protected]\" body=\"Backup .RSC file attached.\\n\\n\" 
subject=\"Auto-export \$subjec\
    t\"\r\
    \n:delay 15s\r\
    \n/tool e-mail send file=\"\$filename.backup\" to=\" 
[email protected] \" body=\"Backup Binary file attached.\\n\\n\" 
subject=\"Auto-backup \$sub\
    ject\"\r\
    \n:log info \"Auto backup sent\""
 
/system schedule
add interval=3d12h name=backups on-event=auto-backup policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
    start-date=jan/01/2014 start-time=12:00:00



-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Josh Luthman
Sent: Friday, April 17, 2015 10:22 AM
To: Mikrotik discussions
Subject: Re: [Mikrotik] Emailing backup on v6

@Ryan same error for me =(

@hilton All my v3, v4, v5 routers don't have start-tls and yet they work.
Not sure if it's maybe defaulted on them or even available.

invalid BODY error on all of these:
/tool e-mail send server=64.233.191.27
 file=backup.backup to="[email protected]"
/tool e-mail send server=64.233.191.27
 file=backup.backup to="[email protected]" subject="nothing"
/tool e-mail send server=64.233.191.27
 file=backup.backup to="[email protected]" subject="nothing"
body="st
ill nothing"


Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373

On Fri, Apr 17, 2015 at 4:16 AM, Hilton Ralphs <[email protected]> wrote:

> I always thought Gmail needed a secure connection to their SMTP 
> servers so I use this in addition to the normal email command;
>
> 'start-tls=yes'
>
> However, I tried just using your command on version 6.27 and if I use 
> my work email address (which is not hosted at Google Apps) I get an 
> "invalid TO Address" error. If I use my home address which IS hosted 
> at Google Apps it works.
>
> /tool e-mail send server=64.233.191.27  file=StCatherines.
> rsc to="[email protected]" subject="nothing" body="still nothing"
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Josh Luthman
> Sent: 17 April 2015 00:32
> To: Mikrotik discussions
> Subject: [Mikrotik] Emailing backup on v6
>
> My backup script seems to not work on v6 anymore.  I keep getting an 
> invalid BODY error.  The server is just GMail's SMTP server (first MX 
> record).
>
> It's nothing more than this:
> /tool e-mail send server=64.233.191.27 file=backupfilehere.rsc to="
> [email protected]" subject=([/system identity get name] . "
>  Backup") body="nothing here
>
> Does anyone have a command that works on v6 (specifically 6.23+) 
> already so I don't have to research/test to find a working method?
>
> Josh Luthman
> Office: 937-552-2340
> Direct: 937-552-2343
> 1100 Wayne St
> Suite 1337
> Troy, OH 45373
> -------------- next part -------------- An HTML attachment was 
> scrubbed...
> URL: <
> http://mail.butchevans.com/pipermail/mikrotik/attachments/20150416/5b2
> 1e76f/attachment.html
> >
> _______________________________________________
> Mikrotik mailing list
> [email protected]
> http://mail.butchevans.com/mailman/listinfo/mikrotik
>
> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik 
> RouterOS
>
> _______________________________________________
> Mikrotik mailing list
> [email protected]
> http://mail.butchevans.com/mailman/listinfo/mikrotik
>
> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik 
> RouterOS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.butchevans.com/pipermail/mikrotik/attachments/20150417/de3d5570/attachment.html>
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS
_______________________________________________
Mikrotik mailing list
[email protected]
http://mail.butchevans.com/mailman/listinfo/mikrotik

Visit http://blog.butchevans.com/ for tutorials related to Mikrotik RouterOS

Reply via email to