Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

domain should send from ip and domain should send from ip

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).

share|improve this question

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
    266         On-link    306         On-link    306         On-link    306         On-link    266         On-link    266         On-link    266         On-link    306         On-link    266         On-link    306         On-link    266

All traffic to the internet ( at this system goes from Interface 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.

share|improve this answer
Our server has multiple internet-visible ips because it serves multiple websites btw. – usr Apr 21 '10 at 22:34
Well, having multiple IP addresses lets you bind services to multiple addresses. The server will still pick one to bind to when you create an outgoing connection. If you have a look at a guide to socket programming such as you will see that you only define the destination address for a client socket. – pehrs Apr 22 '10 at 7:12
This iy python-specific. As a .net programmer I know that you can bind the socket before listening to a port and and ip if you want to (…). EndPoint is a tuple of (ip, port). – usr Apr 22 '10 at 11:45
@usr: You can always pick an IP when you open a socket to listen. But when you create a client socket to connect to another system you don't get to pick the local ip. Difference here is between server socket (or listening socket) and a client socket (or outgoing/connecting socket). – pehrs Apr 22 '10 at 16:25
You can always pick a local endpoint, in both client and server modes. You can call bind before calling connect or listen. In my case all IPs are equivalent from a routing standpoint. For that reason any local endpoint will be able to send. – usr Aug 15 '12 at 11:49

It's not hMailserver which decides which IP address is the sender. That's determined by normal network routing. You will need to pass the outgoing mail for one of the domains to another MTA, which is configured to send that mail out on a particular IP address. As this can be a tricky issue on a single machine I suggest having the second MTA on a separate machine. A minimal virtual machine would do nicely for this.

share|improve this answer
The application can specifiy which ip to use when sending (it can of course also say: i dont care). So in theory hMailserver can decide this. – usr Apr 21 '10 at 22:33
I've just had a look at my hMailserver and can't find that setting. I can tell it what IP address to listen to and what address to rout outgoing mail to but not what IP address to use as the sender. Maybe I've overlooked it, so can you tell me where to set the originating address for a domain so I can test it? – John Gardeniers Apr 21 '10 at 23:04
Thanks for looking! Where can I find the setting where I can say the outgoing address? Thats exactly what I am looking for (hope I can set this per domain...). – usr Apr 22 '10 at 11:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.