测试环境:RouterOS 6.38 (测试OK)
SMTP服务器,端口,寄件人账号密码,收件人邮箱自定义
然后自己把以下脚本在scheduler中创建定时任务即可,on event中就填写script的名字就可以了
#上网接口名称 :local PPPInterface "ADSL-" #设备名称 :local whoami "ROS5.com资源网-ROS主机备份" #SMTP服务器 :local SMTPServer "自定义" #SMTP端口 :local SMTPPort "自定义" #收件人账号 :local SendEmailTo "自定义" #寄件人账号 :local Sender "自定义" #寄件人密码 :local pwd "自定义" #发送Email的主题 :local Themes "ROS Email Assistant" #发送内容 :local Contents "IP Address: " #返回SMTP服务器的IP :local SMTPIP [:resolve $SMTPServer] :delay 3 #Email设置 /tool e-mail set address=$SMTPIP port=$SMTPPort from=$Sender user=$Sender password=$pwd #获取接口IP地址 :local getip [ /ip address get [/ip address find interface=$PPPInterface ] address ] :global IPAddress [:pick $getip 0 [:find $getip "/" ] ] #获取system版本 :global ROSVersion ("RouterOS Version: v" . [/system package get system version] ) #发送Email设置 /tool e-mail send to=$SendEmailTo from=$Sender subject=$Themes body=("$whoami\n$Contents$IPAddress\n$ROSVersion") #日志提醒 :log warning "系统数据已备份,邮件已发送至($SendEmailTo)" :log warning ("外网IP =" ."$IPAddress")
评论前必须登录!
注册