Email-addresses expansion doesn't work on Email forwards to same domain

Preamble: We have configured usernames to be username@domain.com (This results in Unix Usernames being username-domain.com)

I created an email address: coreteam@domain.com

and added forward:

membera@domain.com memberb@domain.com

That got accepted. However, postfix returned mails to sender to email coreteam@domain.com with users membera and memberb unknown.

I could do a workaround with a forward to:

membera-domain.com@domain.com memberb-domain.com@domain.com

Looks like postfix was playing "smart" removing @domain.com then looking for unix users...

But that is beyond normal hosting users skills, so maybe accepting the normal way to write the forwards could be cool for normal users. ;-)

So from a normal user perspective this is a bug imho.

Status: 
Active

Comments

That does look like a bug ..

If you check the /etc/postfix/virtual file for the coreteam alias, what is listed?

You can find these with a command like :

grep coreteam /etc/postfix/virtual /etc/aliases

This is original form (which fails on forwarding mails): membera@domain.com memberb@domain.com

grep coreteam /etc/postfix/virtual /etc/aliases
/etc/postfix/virtual:coreteam@domain.com    coreteam-domain.com
/etc/postfix/virtual:designers@domain.com   coreteam-domain.com
/etc/postfix/virtual:technical@domain.com   coreteam-domain.com
/etc/aliases:coreteam-domain.com: membera@domain.com,memberb@domain.com,\coreteam-domain.com

This is with the worked-around aliases: membera-domain.com@domain.com memberb-domain.com@domain.com

grep coreteam /etc/postfix/virtual /etc/aliases
/etc/postfix/virtual:coreteam@domain.com    coreteam-domain.com
/etc/postfix/virtual:designers@domain.com   coreteam-domain.com
/etc/postfix/virtual:technical@domain.com   coreteam-domain.com
/etc/aliases:coreteam-domain.com: membera-domain.com@domain.com,memberb-domain.com@domain.com,\coreteam-domain.com

Ok, thanks .. one more question - do membera and memberb have their "Primary email address" enabled on the Edit Mailbox page?

Ah, Also our sanity check of system health does choke that: 1) in passwd file, the users have 2 entries 2) that unix usernames are very long (over 16 characters if I remember the warning message) I didn't see any problems with those 2 items, so ignored safely.

e.g.: (changed values to not expose anything):

membera@domain.com:x:1020:1008:MemberA:/home/domain/homes/membera:/dev/null
membera-domain.com:x:1020:1008:MemberA:/home/domain/homes/membera:/dev/null

I did some testing to replicate this problem, but found that the setup you describe actually works fine.

The only case in which it fails is if the Virtualmin domain has the same name as the system's hostname (or the domain part of the hostname). Is that perhaps the case on your system?

yes, the Virtualmin domain has EXCACTLY the same name as the system's hostname in the reported case.

Sorry, didn't realize that would matter for the bug report.

This can cause problems for Postfix actually, as it gets the virtual domain confused with the hostname.

The fix is to change the hostname to something like webserver.domain.com instead of just domain.com. Also, be sure to change the /etc/mailname file, and any use of domain.com in the /etc/postfix/main.cf file, and then restart Postfix.