setup the remote server as such and add MX dns records for the domain to have forwarded to another server.
You need to handle that in the dns for domain.com add 2 record like:
domain.com. MX 10 mail.domain.com
mail.domain.com. A your.ip.addr.ess
For ip access to daomin.com and any hostname therein:
domain.com. A mdaemon.server.ip.address
*.domain.com. A mdaemon.server.ip.address