How to Send Mikrotik Backup e-mail?
To send an email with a regular backup of all system settings, three steps are needed. Firstly you must ensure you have set the outgoing email SMTP server settings in “tool email”, then create the script that generates the backup file itself, lastly is to create a schedule to run that backup script on a regular basis.
First of all, we need to set up email in MikroTik.
winbox the following code we need to write the new terminal.
1 2 3 | /tool e-mail set address=216.58.205.229 from=techsoftcenter@gmail.com password=******* port=587 start-tls=yes user=techsoftcenter@gmail.com |
to be added to the scheduler script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Automatically backups. :log warning "Start Backup MikroTik Router . . . " :global backupfile (backup_[/system identity get name]) :global mikrotikexport (export_[/system identity get name]) :global sub1 ([/system identity get name]) :global sub2 ([/system clock get date]) :global adminmail1 techsoftcenter@gmail.com :global gmailid techsoftcenter@gmail.com :global gmailpwd ******* :global gmailip :set gmailip [:resolve "smtp.gmail.com"]; :log warning "Creating a new backup file. . . " /system backup save name=(backup_[/system identity get name]) /export file=(export_[/system identity get name]) :log warning "Pause backup process for 10 seconds so that it can complete the backup, if the system is busy …" :delay 10s :log info "Sending Files created via Email. . ." /tool e-mail send to=$adminmail1 password=$gmailpwd subject="$sub1 $sub2 file backup" from=$gmailid file=(backup_[/system identity get name].".backup") server=$gmailip start-tls=yes /tool e-mail send to=$adminmail1 password=$gmailpwd subject="$sub1 $sub2 file rsc" from=$gmailid file=(export_[/system identity get name].".rsc") server=$gmailip start-tls=yes :log warning "Backup completed successfully." :delay 20s # Automatically delete old backups. /file remove (backup_[/system identity get name].".backup") /file remove (export_[/system identity get name].".rsc") :log warning "Backup file remove completed. . ." |
I hope it has been a useful article.