Sharma, Ashish 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.

You could implement part of what you described with header_checks and a few regular expressions, however I suspect this won't accomplish what you want to do, and won't handle bCC in any event, since BCC isn't a message header.

Messages are delivered based on envelope information, not message headers. Message headers are completely irrelevant for message delivery. The recipient information is envelope information, which is transmitted during the SMTP protocol.

If you really want to only allow single recipient messages, I'd suggest writing a custom plugin for a mail filter like amavis.

Terry

--
Terry Carmen
CNY Support, LLC
http://cnysupport.com

Reply via email to