####Modify these values to match your requirements###
#Your email address to receive the backups
:local toemail “warna.syafril@gmail.com”
#The From address (you can use your own address if you want)
:local fromemail “agenbackup@lapakvirtual.my.id”
#A mail server your machines can send through
:local emailserver “192.168.100.2”
######## Don’t edit below this line
:local sysname [/system/identity/get name]
:local textfilename
:local time [/system/clock/get time]
:local date [/system/clock/get date]
:local newdate “”;
:for i from=0 to=([:len $date]-1) do={ :local tmp [:pick $date $i];
:if ($tmp !=”/”) do={ :set newdate “$newdate$tmp” }
:if ($tmp =”/”) do={}
}
#check for spaces in system identity to replace with underscores
:if ([:find $sysname ” “] !=0) do={
:local name $sysname;
:local newname “”;
:for i from=0 to=([:len $name]-1) do={ :local tmp [:pick $name $i];
:if ($tmp !=” “) do={ :set newname “$newname$tmp” }
:if ($tmp =” “) do={ :set newname “$newname_” }
}
:set sysname $newname;
}
:set textfilename ($”newdate” . “-” . $”sysname” . “.rsc”)
:execute [/export file=$”textfilename”]
#Allow time for export to complete
:delay 10s
#email copies
:log info “Emailing backups”
/tool/e-mail/send to=$”toemail” from=$”fromemail” server=$”emailserver” port=25 subject=”[Config Backup] $sysname $time” file=$”textfilename”
#Send as different subjects to force GMail to treat as new message thread.
:local time [/system/clock/get time]
#Allow time to send
:delay 20s
#delete copies
/file/remove $textfilename