Postfix to send all mail to /dev/null except one address (alias)

1

My postfix server is working on a particular domain name through a relay, so it's like that: Client send to abs@subdomain.domain.com -> domain.com production mail server -> internal mail server on subdomain.

All messages for subdomain.domain.com are being forwarded. But the thing is, the application that I'm supporting uses mailing system for some internal stuff and many addresses that are being CC when client is sending e-mail doesn't exist on subdomain mail server, they serve another purpose. When app on subdomain receives e-mail, it parses headers and uses all CC addresses in it's algorithms.

Here comes the problem. When client sends an e-mail, he'll receive as many error responses as there are fake addresses in CC. There is only one real address that is listed in /etc/aliases and it's just piping incoming mails to stdin for some script.

Question. How do I prevent sending error responces to the client and just /dev/null all fake addresses? I need only 1 address, that is listed in aliases.

Thanks in advance.

ZackFair

Posted 2014-07-09T08:36:16.343

Reputation: 21

Answers

1

Ok, I figured it out.

This can be achieved through virtual_alias_maps. Add an virtual alias for domain and for address. Redirect domain to /dev/null and address to local alias.

virtual_alias_maps file:

target_addr@subdomain      target@localhost
@subdomain      devnull@localhost

/etc/aliases:

target:  "| /path/to/script"
devnull:  /dev/null

ZackFair

Posted 2014-07-09T08:36:16.343

Reputation: 21