Postfix Hostname

SYSTEM INFORMATION
OS type and version Ubuntu Linux 20.04.5
Webmin version 2.021
Virtualmin version 7.5

Hello!
I Have a VPS with multiple domains and each of those domains have a dedicated IP.
I can send emails for all domains however I can see that no matter the domain the hostname on the email headers will be the same for all domains. Is there a way to customise this so each domain will use his domain as the hostname?

Many thanks.

run multiple instances of postfix with the correct config… but to be fair is this really a problem ? most people will not dig through headers to find this. As long as the mail gets there who is worried ?

Thanks for the reply but I do need to have a different hostname for each of the domains.

so this is not an issue ?

No issues sending/receiving emails. I just want a different hostname per domain.

will work … but I still don’t see the issue

But some do - so I guess that is the problem. So multiple instances of Postfix is a solution?

look at Managing multiple Postfix instances on a single host
but I still don’t see why … a mail host is a mail host … or is it not ?

2 Likes

Probably not a solution that is worth the effort. But, like pointed out above, almost no one will ever see it. I worked at a place where our ‘forensic expert’ didn’t even know how to check email headers. :roll_eyes:

As long as you have an IP per domain, you can use sender-dependent transport maps to send out via a different IP per domain. This is not a useful thing to do, and I am not recommending you do it (it’s more hassle to maintain, more difficult to troubleshoot, etc.). But, some people want to do it anyway.

I think as long as you have entries in your hosts files for all those names and proper records in DNS for your zones, it will do what you want, but I’m not sure of it. What you’re trying to do is, again, not a useful thing to do. There is nothing wrong with sending mail for many domains from a single hostname. Google does it for probably millions of domains. I think you’re wasting time on something that nobody cares about or derives any value from.

it can be. thanks

yes but, in this case I cannot have a common link between the domains.

Hi Joe, thank you very much for your input. I really do need to have a solution where there’s no common link on it. I know that my competitor will look for a common IP, hostname or whatever to associate a domain to a network.

Just did this myself the other day, master.cf

You should have smtp, smtps and submission lines here for each domain added. If you preface the line with the IP and add the bind and hostname fields to the line you end up with something like so:

x.x.x.x:smtp	inet	n	-	y	-	-	smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may -o myhostname=hostname.domain.tld -o smtp_bind_address=x.x.x.x -o smtp_bind_address6=x:x:x:x

x.x.x.x:submission	inet	n	-	y	-	-	smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may -o myhostname=hostname.domain.tld -o smtp_bind_address=x.x.x.x -o smtp_bind_address6=x:x:x:x

x.x.x.x:smtps	inet	n	-	y	-	-	smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may -o smtpd_tls_wrappermode=yes -o myhostname=hostname.domain.tld -o smtp_bind_address=x.x.x.x -o smtp_bind_address6=x:x:x:x

Then do this for each domain and server hostname you’d like to return.

1 Like

Hi lilfade, thank you for the suggestion, but I dont have a line for each domain added, just like this:

submission inet n - y - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may
smtps inet n - y - - smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may -o smtpd_tls_wrappermode=yes
smtp-16283340644026445 unix - - y - - smtp -o smtp_bind_address=x.x.x.x

Those are all about the listen addresses, nothing to do with outgoing mail.

But, the example given included a place to put the IP (x.x.x.x would be replaced with IP addresses), if for some reason you also wanted to listen on different IPs for different domains. But, that’s not useful, either (again, you’re going to a lot of trouble for things that don’t matter).

Given the OP’s stated purpose, they should not have all the domains on one server at one provider anyhow.

That’s even more complicated!

I am recommending the simplest thing that can work. If OP really needs to send out of different IPs, then the sender dependent maps feature does that. If OP really needs to receive on multiple IPs, the suggestion of mrlostbyte does that.

Most people do not need to do either thing. Most people should not do either thing.

Not saying it isn’t. If his domains are on the same server with consecutive IP’s, that will be much easier for a competitor to spot than the email headers. OP seems to think they really need this kind of separation.

Life can be like that :sob: