email的发送设置,可以从 Tools / Email 进行设置,测试看是否可以成功发送。
代码如下,代码记得前后要有大括号!!
{#上网接口名称
:local PPPInterface "ros_pppoe";
#设备名称
:local whoami "Hi,";
#发送Email的主题
:local Themes "ROS Email Assistant";
#发送内容
:local Contents "IP Address: ";
:local SendEmailTo "xxxxx@qq.com";
#获取接口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 package find name=routeros] version] );
#发送Email设置
/tool e-mail send to=$SendEmailTo subject=$Themes body=("$whoami\n$Contents$IPAddress\n$ROSVersion");
#日志提醒
:log warning "系统数据已备份,邮件已发送至($SendEmailTo)";
:log warning ("外网IP =" ."$IPAddress");
}