need a script for backup and email with details

Hello I need a script where I can do a backup and .rsc export. And send this files to my email.
In bestway the backup and .rsc had a timestamp, datestamp, and the name from my hotspot.

Have you tried to try http://lmgtfy.com/?q=mikrotik+email+backup

Does this help?

I’m trying to learn this too.

Updated check it again

Google is your best friend, so ask him :exclamation:
If u want to send mail from mikrotik, you need first configure email in /tool e-mail

Here is my script for send backup over email:

:log info "Backup to e-mail is started"

:global backupfile ([/system identity get name] . "-" . [/system clock get time])

/system backup save name=$backupfile

:log info "backup pausing for 12s"

:delay 12s

:log info "backup being emailed"

/tool e-mail send to="mikrotik@mydomain.com" subject=([/system identity get name] . "-" . [/system clock get time] . \

" Backup - 172.17.210.2") from=mikrotik@mydomain.com file=$backupfile server=mail.mydomain.com

/tool e-mail send to="it@mydomain.com" subject=([/system identity get name] . "-" . [/system clock get time] . \

" Backup - 172.17.210.2") from=mikrotik@mydomain.com file=$backupfile server=mail.mydomain.com

:delay 10s

:log info "Deleting file from MT"

/file remove "$backupfile"

:log info "Finished Backup Script"

Important!
If you want to use gmail, you need to give access mikrotik to send mail. You can change this configuration in google settings

if someone needs to make a backup of the system and files of usermanager via ftp, I use this.
I hope to please
######################################strart script#############################################################

automated backup External ftp

ftp configuration

:local ftphost “1.1.1.1”
:local ftpuser “backup”
:local ftppassword “**********”
:local ftppath “prova”

months array

:local months (“jan”,“feb”,“mar”,“apr”,“may”,“jun”,“jul”,“aug”,“sep”,“oct”,“nov”,“dec”);

get time

:local ts [/system clock get time]
:set ts ([:pick $ts 0 2].“:”.[:pick $ts 3 5]);

get Date

:local ds [/system clock get date]

convert name of month to number

:local month [ :pick $ds 0 3 ];
:local mm ([ :find $months $month -1 ] + 1);
:if ($mm < 10) do={ :set mm (“0” . $mm); }

set $ds to format DD-MM-YYYY

:set ds ([:pick $ds 4 6] .“-”. $mm .“-”. [:pick $ds 7 11]);

file name for user manager backup - file name will be UMDB-servername-date-time.umb

:local fname (“/BK-”.[/system identity get name].“-”.$ds.“-”.$ts.“.umb”)

file name for system backup - file name will be UMDB-servername-date-time.backup

:local fname1 (“/BK-”.[/system identity get name].“-”.$ds.“-”.$ts.“.backup”)

file name for config export - file name will be UMDB-servername-date-time.rsc

:local fname2 (“/BK-”.[/system identity get name].“-”.$ds.“-”.$ts.“.rsc”)

file name for user manager backup - file name will be UMDB-servername-date-time.umb

:local fname3 (“/BK-LOG-”.[/system identity get name].“-”.$ds.“-”.$ts.“.umb”)

backup the data

/tool user-manager database save name=$fname
:log info message=“User manager backup finished (1/4).”;
/system backup save name=$fname1
:log info message=“System backup finished (2/4).”;
/export compact file=$fname2
:log info message=“Config export finished (3/4).”;
/tool user-manager database save-log name=$fname3
:log info message=“User manager log backup finished (4/4).”

upload the user manager backup

:log info message=“Uploading user manager backup (1/4).”
/tool fetch address=“$ftphost” src-path=$fname user=“$ftpuser” mode=ftp password=“$ftppassword” dst-path=“$ftppath/$fname” upload=yes

upload the system backup

:log info message=“Uploading system backup (2/4).”
/tool fetch address=“$ftphost” src-path=$fname1 user=“$ftpuser” mode=ftp password=“$ftppassword” dst-path=“$ftppath/$fname1” upload=yes

upload the config export

:log info message=“Uploading config export (3/4).”
/tool fetch address=“$ftphost” src-path=$fname2 user=“$ftpuser” mode=ftp password=“$ftppassword” dst-path=“$ftppath/$fname2” upload=yes

upload the user manager log backup

:log info message=“Uploading user manager log backup (4/4).”
/tool fetch address=“$ftphost” src-path=$fname3 user=“$ftpuser” mode=ftp password=“$ftppassword” dst-path=“$ftppath/$fname3” upload=yes

delay time to finish the upload - increase it if your backup file is big

:delay 60s;

find file name start with UMDB- then remove

:foreach i in=[/file find] do={ :if ([:typeof [:find [/file get $i name] “BK-”]]!=“nil”) do={/file remove $i}; }
:log info message=“Configuration backup finished.”;
#############################################end script##########################################################################

Here is a script which does everything you wanted.
https://github.com/beeyev/Mikrotik-RouterOS-automatic-backup-and-update

thanks for your help