So I have several servers all set up to send and receive mails from multiple domains, this all works perfectly fine.

However a few people have complained that within the mail headers you still see the name of the server being used, we'll call it "mail1.example.com". They can send and receive mail fine, it's showing their email addresses, using the right DKIM reports etc but they don't like having to have SPF records within their DNS specifically for my server or the headers.

Is it possible in any way with Postfix to "virtualise" the usage of "myhostname" so that it can pic/choose which server name to use?


Is it possible in any way with Postfix to "virtualise" the usage of "myhostname" so that it can pic/choose which server name to use?

No, that's not possible. The only way to achieve this would be runnung multiple smtpd instances, each on its own IP address, with a custom configuration of myhostname.

Virtualisation in mail servers, similar to VirtualHosts in your favorite web server, is not possible with SMTP since there is no way to indicate the intended virtual host on the protocol level (like the HTTP/1.1 Host header).


I assume you are referring to the Received part of the headers? While it might be possible to do creative things with the HELO hostname your server used to introduce yourself you will still be stuck with the reverse lookup of your ip address. Having an HELO hostname which differs from the name associated with your IP address is something not always looked upon favorable på various spam filters etc. I short I would say there is no good way to "virtualise" the hostname used to contact other SMTP servers.

Regarding your users and their SPF records, I assume their domains have a MX post pointing at your mail server? In that case they only have to add the MX option to their SPF recods, which I guess would be a bit cleaner.

  • SPF records is set to include from one of our text records, to keep it clean and easy to maintain, the issue really for the client is not having email as seen as coming from one of their servers. – kura Dec 4 '09 at 0:06

The problem you run into is that the foreign mailservers append each header to the Email itself. So you are connection from ip and the foreign mailserver does a reverse lookup of this ip address. If mail comes from it is done also. So you can modify your reverse lookups to resolve each different ip to the same hostname.

Thats the only option that exists, because you are not able to forge the IP adrress of the mailserver within postfix itself. And I hope we are talking about the same thing.

If you only want to modify myhostname set these values in your main.cf

myhostname =
mydomain = 
myorigin =

But I guess that will not solve your problem without modifying the reverse lookup thing.

  • Yeah, I figured that would be the case. I've also spent a lot of time looking at headers and helo responses of other companies and see they all just have their actual servers name. This is something the client will just have to deal with, after all it is only a received from header, unless they go digging they shouldn't even see it. – kura Dec 4 '09 at 0:06

SPF (rightly) doesn't trust anything the remote mailserver tells it, so multiple "myhostname" will do nothing apart from removing your name from the headers.

There's a few ways to deal with the SPF problem:

  • Give your customers an include (eg, Google use _spf.google.com) for the include: directive
  • Assign multiple PTR records so they can use the SPF ptr flag (yes this works, although it's not well known)
  • If they're inbound then they can just use the mx flag

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy