home | list info | list archive | date index | thread index

Re: postfix and multiple domains

Tug Williams via linux wrote on 2026-03-24 08:51:
Minor semi-tangent. When I decided to add a new domain, the internet first encouraged me to change
    myhostname = mydomain1.com
to
    myhostname = mail.mydomain1.com

The justification seemed sort of sensible, but I wonder whether the faffing was worth it. Is this "correct" or "who cares", given I doubt I will ever have multiple IP addresses, so don't need to distinguish web sites from email servers?

It's probably more of a Best Practices but not Essential. Postfix docs say:

> $myhostname <https://www.postfix.org/postconf.5.html#myhostname> is used as a default value for many other configuration parameters.

but they do not specify which those other parameters are, so... whatever hostname is shown by, say, `hostnamectl` is a good idea.


I'm using linux system accounts, and had administered catchall via /etc/postfix/virtual
user [ at ] mydomain1 [ dot ] com user
  @mydomain1.com user

Okay, virtual is good...


postconf -n (heavily snipped)

mydestination = localhost, localhost.$mydomain, mydomain1.com

If using virtual transport delivery, note this:

> NEVER list a virtual MAILBOX domain <https://www.postfix.org/ADDRESS_CLASS_README.html#virtual_mailbox_class> name as a mydestination <https://www.postfix.org/postconf.5.html#mydestination> domain!

www.postfix.org

Postfix Virtual Domain Hosting Howto <#>

🔗 https://www.postfix.org/VIRTUAL_README.html#virtual_mailbox <https://www.postfix.org/VIRTUAL_README.html#virtual_mailbox>


virtual_alias_domains = mydomain2.com
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/postfix/virtual contains
user [ at ] mydomain1 [ dot ] com user
user [ at ] mydomain2 [ dot ] com user

user2 [ at ] mydomain2 [ dot ] com user2

@mydomain1.com user
@mydomain2.com user

/etc/postfix/virtual.db is generated

So, what I would look at is removing mydomain1.com from $mydestination and then see what happens.


Probably not a complete answer, but hopefully a step in the right direction.


(Reviewing some of this, and the docs, and my main.cf files... I gotta admit I kinda hate postfix sometimes.

I'm now thinking I need a deep-dive review of virtual_mailbox_domains, virtual_mailbox_maps, virtual_mailbox_base, virtual_alias_maps,... It all works, but I forget how & why.)

message navigation