Took waaaaay too much effort but here it is.  This sends using and to a
Gmail account.

/tool e-mail
set address=74.125.45.108 from=u...@domain.com last-status=\
    succeeded password=PASSWURD port=587 user=u...@gmail.com

:log info "Mikrotik Backup JOB Started . . . By Syed Jahanzaib"
:global backupfile configbackup
:global mikrotikexport mtexport_backup
:global umbackup um_backup
:global gmailsmtp
:set gmailsmtp [:resolve "smtp.gmail.com"];
:log info "Deleting old Backup File If available otherwise ignore & process
further . . . "
/system backup save name=$backupfile
/export file=$mikrotikexport

:log info "Backup process pausing for 30s so it may complete creating
backup files"
:delay 30s
:log info "Start Sending Backup File via Email using GMAIL SMTP  . . ."

/tool e-mail send to="usern...@domain.com" password=PASSWORD
subject=SUBJECTgoesHERE from=usern...@domain.com file=$backupfile
server=$gmailsmtp start-tls=yes
/tool e-mail send to="usern...@domain.com" password=PASSWORD
subject=SUBJECTgoesHERE from=usern...@domain.com file=$mikrotikexport
server=$gmailsmtp start-tls=yes

:delay 60s
:log info "Backup Finished"
:log info "Deleting Backup File. All Done."

/file remove $backupfile
/file remove $mikrotikexport


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

On Mon, Apr 20, 2015 at 12:14 AM, D. Ryan Spott <rsp...@irongoat.net> wrote:

> Yessir, the 5K+ emails in my backups@ email address show this working.
>
> ryan
>
>
>
>
> On 4/19/15 2:18 PM, Josh Luthman wrote:
>
>> I've got a user so it can do SMTP auth.  This script gives me an abnormal
>> termination (timeout) error.  Does that definitely work for you in v6?
>>
>>
>> Josh Luthman
>> Office: 937-552-2340
>> Direct: 937-552-2343
>> 1100 Wayne St
>> Suite 1337
>> Troy, OH 45373
>>
>> On Sat, Apr 18, 2015 at 3:27 PM, D. Ryan Spott <rsp...@irongoat.net>
>> wrote:
>>
>>  Sorry for the bad script before, it does work against NON gmail for a
>>> consulting client of mine.
>>>
>>> This script is working to gmail from a mtik running 6.27:
>>>
>>> /system script
>>> add name=backup
>>> policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive
>>> source=":global sysname [/system identity get name]\r\
>>>      \n:local datetime [/system clock get date]\r\
>>>      \n\r\
>>>      \n:log info \"\$datetime \$sysname Backup Started\";\r\
>>>      \n\r\
>>>      \n/export file=export.rsc\r\
>>>      \n/system backup save name=backup.backup dont-encrypt=yes\r\
>>>      \n\r\
>>>      \n:delay 20s\r\
>>>      \n\r\
>>>      \n/tool e-mail send to=\"back...@domain.com\" subject=\"company
>>> Export \$sysname \$[/system clock get date]\" from=back...@domain.com
>>> file=export.rsc start-tl\
>>>      s=yes \r\
>>>      \n\r\
>>>      \n:delay 20s\r\
>>>      \n\r\
>>>      \n/tool e-mail send to=\"back...@domain.com\" subject=\"company
>>> Backup \$sysname \$[/system clock get date]\" from=back...@domain.com
>>> file=backup.backup start\
>>>      -tls=yes \r\
>>>      \n\r\
>>>      \n:log info \"\$datetime \$sysname Backup Ended\";"
>>>
>>>
>>>
>>> /tool e-mail
>>> set address=74.125.25.16 from=back...@domain.com password=foobar port=\
>>>      587 user=back...@domain.com
>>>
>>> ryan
>>>
>>>
>>>
>>> On 4/17/15 12:10 PM, Josh Luthman wrote:
>>>
>>>  I was avoiding all that because imaginenetworksllc.com is hosted by
>>>> Gmail.
>>>> I didn't want to deal with SMTP authentication to get it relayed,
>>>> thought
>>>> that looks like my only solution at this point =/
>>>>
>>>>
>>>> Josh Luthman
>>>> Office: 937-552-2340
>>>> Direct: 937-552-2343
>>>> 1100 Wayne St
>>>> Suite 1337
>>>> Troy, OH 45373
>>>>
>>>> On Fri, Apr 17, 2015 at 3:06 PM, Grand Avenue Broadband <
>>>> grandav...@grandavebb.com> wrote:
>>>>
>>>>   You don’t have to use the Gmail SMTP server just because your
>>>> receiving
>>>>
>>>>> account is at Gmail.  Gmail has a reputation for being extra-picky and
>>>>> not
>>>>> working and playing well with many other systems.  Is there a server
>>>>> you
>>>>> can use that is associated with your hosting site at
>>>>> imaginenetworksllc.com?  Any SMTP server for which you have a password
>>>>> will do.
>>>>>
>>>>>
>>>>> On Apr 17, 2015, at 9:55 AM, Josh Luthman <j...@imaginenetworksllc.com
>>>>> >
>>>>> wrote:
>>>>>
>>>>>   invalid BODY with this one as well =(  There's got to be something
>>>>> wrong
>>>>>
>>>>>> with the email functionality between Mikrotik and Gmail.
>>>>>>
>>>>>>
>>>>>> Josh Luthman
>>>>>> Office: 937-552-2340
>>>>>> Direct: 937-552-2343
>>>>>> 1100 Wayne St
>>>>>> Suite 1337
>>>>>> Troy, OH 45373
>>>>>>
>>>>>> On Fri, Apr 17, 2015 at 12:51 PM, Wayne Hancock <
>>>>>> whanc...@sandridgeenergy.com> wrote:
>>>>>>
>>>>>>   I use the following, is working well for me.
>>>>>>
>>>>>>>
>>>>>>> /tool e-mail
>>>>>>> set address=XX.XX.XX.XX from=MikroTik<mikro...@xxxxxxx.com>
>>>>>>> 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=\"wheretosend....@youremail.com\" 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=\"
>>>>>>> wheretosend.bac...@youremail.com \" 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: mikrotik-boun...@mail.butchevans.com [mailto:
>>>>>>> mikrotik-boun...@mail.butchevans.com] 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="back...@imaginenetworksllc.com"
>>>>>>> /tool e-mail send server=64.233.191.27
>>>>>>> file=backup.backup to="back...@imaginenetworksllc.com"
>>>>>>>
>>>>>>>  subject="nothing"
>>>>>> /tool e-mail send server=64.233.191.27
>>>>>>
>>>>>>> file=backup.backup to="back...@imaginenetworksllc.com"
>>>>>>>
>>>>>>>  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 <hil...@think.co.za>
>>>>>>>
>>>>>>>  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="hil...@think.co.za" subject="nothing" body="still nothing"
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: mikrotik-boun...@mail.butchevans.com [mailto:
>>>>>>>> mikrotik-boun...@mail.butchevans.com] 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="
>>>>>>>> j...@imaginenetworksllc.com" 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
>>>>>>>> Mikrotik@mail.butchevans.com
>>>>>>>> http://mail.butchevans.com/mailman/listinfo/mikrotik
>>>>>>>>
>>>>>>>> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
>>>>>>>> RouterOS
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Mikrotik mailing list
>>>>>>>> Mikrotik@mail.butchevans.com
>>>>>>>> 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
>>>>>>> Mikrotik@mail.butchevans.com
>>>>>>> http://mail.butchevans.com/mailman/listinfo/mikrotik
>>>>>>>
>>>>>>> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
>>>>>>> RouterOS
>>>>>>> _______________________________________________
>>>>>>> Mikrotik mailing list
>>>>>>> Mikrotik@mail.butchevans.com
>>>>>>> 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/8ef9c794/attachment.html
>>>>>
>>>>>  _______________________________________________
>>>>>> Mikrotik mailing list
>>>>>> Mikrotik@mail.butchevans.com
>>>>>> http://mail.butchevans.com/mailman/listinfo/mikrotik
>>>>>>
>>>>>> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
>>>>>>
>>>>>>  RouterOS
>>>>>
>>>>> _______________________________________________
>>>>> Mikrotik mailing list
>>>>> Mikrotik@mail.butchevans.com
>>>>> 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/beed60a2/attachment.html
>>>> _______________________________________________
>>>> Mikrotik mailing list
>>>> Mikrotik@mail.butchevans.com
>>>> http://mail.butchevans.com/mailman/listinfo/mikrotik
>>>>
>>>> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
>>>> RouterOS
>>>>
>>>>  --
>>> D. Ryan Spott | Iron Goat Networks, llc
>>> broadband | telco | colo | community
>>> PO Box 1232 / 603 W. Stevens Sultan, WA 98284
>>> 360-799-0552 | gtalk: rsp...@irongoat.net
>>>
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL: <
>>>
>>> http://mail.butchevans.com/pipermail/mikrotik/attachments/20150418/c7bd575d/attachment.html
>>> _______________________________________________
>>> Mikrotik mailing list
>>> Mikrotik@mail.butchevans.com
>>> 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/20150419/dfd8d6d3/attachment.html
>> >
>> _______________________________________________
>> Mikrotik mailing list
>> Mikrotik@mail.butchevans.com
>> http://mail.butchevans.com/mailman/listinfo/mikrotik
>>
>> Visit http://blog.butchevans.com/ for tutorials related to Mikrotik
>> RouterOS
>>
>
> --
> D. Ryan Spott | Iron Goat Networks, llc
> broadband | telco | colo | community
> PO Box 1232 / 603 W. Stevens Sultan, WA 98284
> 360-799-0552 | gtalk: rsp...@irongoat.net
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.butchevans.com/pipermail/mikrotik/attachments/20150419/e800f496/attachment.html
> >
>
> _______________________________________________
> Mikrotik mailing list
> Mikrotik@mail.butchevans.com
> 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/20150421/f60c276e/attachment.html>
_______________________________________________
Mikrotik mailing list
Mikrotik@mail.butchevans.com
http://mail.butchevans.com/mailman/listinfo/mikrotik

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

Reply via email to