Documentation
Documentación » VPS » Mikrotik router backup by e-mail

Mikrotik router backup by e-mail

In the script, you must edit the values in bold, then just paste the code in the terminal of your Mikrotik .
The following code performs the following actions:
  • Configure the Mikrotik router to make use of an SMTP account and thus be able to send emails from the router
  • Delete if it already exists and create a task called export-send that will run every day at 00:00
  • Delete if it already exists and create a script called export-send that will be the one that executes the previously defined task.
/tool e-mail set address=TU-DOMINIO.com from=mikrotik@TU-DOMINIO.com user=mikrotik@TU-DOMINIO.com password=PASSWORD port=465 start-tls=tls-only 

/system clock set time-zone-name=Europe/Madrid

/system scheduler remove export-send

/system scheduler add interval=1d name=export-send on-event=export-send start-time=00:00:00

/system script remove export-send 

/system script add name=export-send owner=TU-USUARIO source="/export\_file=export\r\
    \n\r\
    \n/tool e-mail send to=\"destinatario@TU-DOMINIO.com\" subject=\"\$[/system identity get name]\" body=\"\$[/system clock get date] configuration file\" file=export"