ROS based email relay?

ROS itself does have an email client already. Can it be used for something trickier than configuration sending?
Namely I have 2 outside lines and in case of failure I have script controllable failover for Internet traffic, but I am unable to control outbound email server selections for internal computers. What is my options for automatic failover for outbound email sending?

Maybe destination NAT would work? As part of your existing fail over scripts enable and disable NAT rules that rewrite packet headers to direct mail traffic to specific servers.

If I have understood right, you may use static short-time DNS record of your mail server that will be rewriting using netwatch. So if line is up, smtp.my.com will be IP_1, else it will be IP_2.

If your clients are not using your DNS or are not using domain name of SMTP server, this will not work, of course - then you should use redirection in firewall controlled by netwatch.

Thanks, I’ll try out some of those proposed ideas.

I implemented that DNS based e-mail server changing system by setting 2 static DNS records with the same name to point to different ISP e-mail servers:

/ip dns
set allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB \
    max-udp-packet-size=512 servers=a.a.a.a,b.b.b.b
/ip dns static
add address=x.x.x.x disabled=no name=mail.myownmail.yy ttl=5s
add address=y.y.y.y disabled=yes name=mail.myownmail.yy ttl=5s

And my other scripts detecting ISP link downing are invoking appopriate mail.myownmail.yy DNS record setting:

/system script
add name=email_one policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
    source=":local Items;\r\
    \n:local Item;\r\
    \n:log info message=\"Outbound e-mail set to y.y.y.y.\";\r\
    \n:set Items [/ip dns static find address=\"x.x.x.x\"];\r\
    \n:foreach Item in=\$Items do={/ip dns static disable \$Item};\r\
    \n:set Items [/ip dns static find address=\"y.y.y.y\"];\r\
    \n:foreach Item in=\$Items do={/ip dns static enable \$Item};"
add name=email_two policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
    source=":local Items;\r\
    \n:local Item;\r\
    \n:log info message=\"Outbound e-mail set to x.x.x.x.\";\r\
    \n:set Items [/ip dns static find address=\"x.x.x.x\"];\r\
    \n:foreach Item in=\$Items do={/ip dns static enable \$Item};\r\
    \n:set Items [/ip dns static find address=\"y.y.y.y\"];\r\
    \n:foreach Item in=\$Items do={/ip dns static disable \$Item};"

Note: a.a.a.a, b.b.b.b, x.x.x.x, and y.y.y.y are site specific.