Windows – How to send mail with hMailserver from different IPs for different domains

windowswindows-server-2008

domain abc.com should send from ip 1.1.1.1 and domain xyz.com should send from ip 2.2.2.2

I could not find how to configure the the IP for bothh domains differently. However I already found where to change the IP for all domains (under TCP/IP Ports).

Best Answer

That's not a decision hMailserver can easily make, as hMailserver relies on the TCP/IP stack in your system for the transport. Therefor the outgoing interface is decided by the routing decision your kernel makes. Typically you will have a routing table like this:

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     192.168.0.42     192.168.0.16    266
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.0.0    255.255.255.0         On-link      192.168.0.16    266
     192.168.0.16  255.255.255.255         On-link      192.168.0.16    266
    192.168.0.255  255.255.255.255         On-link      192.168.0.16    266
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link      192.168.0.16    266
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link      192.168.0.16    266
===========================================================================

All traffic to the internet (0.0.0.0/0) at this system goes from Interface 192.168.0.16. Even if you add a second interface with the same gateway, netmask and metric the computer will just pick one of the two and always use that one. So there is no easy way to do what you want.