I am setting up an Ubuntu 14.04 mail relay network using postfix 2.11. It is set up to allow the following configuration:
Code:
javamail_client -> localhost postfix -> relay postfix -> internet
Please note lack of any inbound mail in this setup. It is intentional.
In general, this is working well for most emails. The javamail client is perceived by the localhost postfix to be another email server. The localhost postfix is configured as a "local relay" server, meaning it is locked down to only accept mail originating on the localhost, and then forwards it to the more knowledgeable relay postfix server which attempts to deliver it to the internet. The relay server only accepts mail from the local network machines. This allows mail from <anyuser@anydomain> to be delivered to <anyuser@anydomain>. It is what I want to occur.
As I stated this works great as long as the email addresses involved conform to internet standards. However, because the developers do little to no address validation in the originating app, occasionally, there will be a destination email that postfix will interpret as a local user. When this happens, postfix dutifully issues the following error to the javamail program:
Code:
550 5.1.1 <username>: Recipient address rejected: User unknown in local recipient table
Unfortunately, the javamail program generally ignores the error. It doesn't notify the end user in any way, in most cases.
Since the developers are unlikely to fix the code soon - the ticket has been around for years - I would like to have the "localhost postfix" generate an NDR instead of generating the 550, or perhaps as well as generate the error, in the hopes that the end users will correct their problems on their own. Does anyone have any suggestion on how to accomplish this task?
One thing I've tried that somewhat accomplishes my goal is to change the value of /etc/mailname to an invalid server name. This seems to allow the localhost postfix to accept the email and forward it to the relay server, which then fails at sending it and generates the NDR. However, I'm not sure what effect that will have on other services on the localhost that are sending mail to actual local users.