The reason why my first patch didn't work with aliases that expanded into a non-existant local user was because the right-hand side of the alias didn't have a host name.
t1: alainx => not OK, no hostname
t2: <email address hidden> => ok
t3: <email address hidden> => also ok
The new version of the patch now works in all cases:
1. If a local domain name is attached to the recipient, that one is used, so servers with multiple names in class w preserve the correct name
2. If a local domain name is not attached to the recipient, $j ("canonical" local host name) is used instead.
The reason why my first patch didn't work with aliases that expanded into a non-existant local user was because the right-hand side of the alias didn't have a host name.
t1: alainx => not OK, no hostname
t2: <email address hidden> => ok
t3: <email address hidden> => also ok
The new version of the patch now works in all cases:
1. If a local domain name is attached to the recipient, that one is used, so servers with multiple names in class w preserve the correct name
2. If a local domain name is not attached to the recipient, $j ("canonical" local host name) is used instead.