On Dec 8, 2009, at 10:14 AM, "Sharma, Ashish" <ashish.shar...@hp.com> wrote:

Hi,



I have a Postfix mail-receiving server.



I have to filter the received e-mail according to the logic:



1. Only mails sent to the recipient registered on my email server would be accepted.

2. Mails sent to the recipient registered on my e-mail server would be rejected if any other recipient of the mail has been specified in To, CC or BCC header.



Now I have two options:



1. Write a mail-filter (milter), parse the incoming headers of the mail and implement the logic (I know how to do this).

2.       Using custom postfix feature as listed here: 
http://www.postfix.org/BUILTIN_FILTER_README.html



I have very less idea of option 2,



and Will I be able to achieve my intended logic by option 2?



If yes please give some good examples.



Also, which option would be efficient regarding performance and memory usage wise?

I think you are being overly complex. Read some documentation: postconf (5) is a good start to understand how Postfix rejects mail for everyone except recipients YOU designate as valid. For the second point, it seems you just need a simple policy service that checks for recipient count and rejects mail if it is > 1. Also note that there is no BCC header in mail that arrives on your server.

Reply via email to