SMTP redirect to domain name not IP ?

Is there a way to do this

ip firewall nat add chain=dstnat protocol=tcp dst-port=25 action=dst-nat to-addresses=10.0.0.1 to-ports=25

but with a domain name as the dest mail server ?

The only way is to use scripting:

Create the nat rule:

/ip firewall nat add chain=dstnat protocol=tcp dst-port=25 action=dst-nat to-ports=25 comment="SMTP domain redirect"

Create the script:

/ip firewall nat {
   :local smtpdomain "smtp.yourdomain.com"
   set [find comment="SMTP domain redirect"] to-addresses=[:resolve $smtpdomain]
}

Then, create a scheduler:

/system scheduler add name="SMTP Domain Redirect" start-time=startup interval=5m on-event="<script name>" disabled=no

Interesting. I will test this out.

Thanks