Lucio [EMAIL PROTECTED] wrote:
> Alessandro Vesely wrote:
> > Courier already has a big-brother option.
> 
> Yes, I know. But I need the users to be aware of the fact that their
> messages are being sniffed, so I have to force them to send CCs of
> thier messages to the big-brother address.

When I read your first message, I decided not to write a reply as I didn't
want to encourage eavesdropping.  But now that you explained that you
explicitly _want_ your users to be aware of it, I think this is something
I can justify helping you with.

So let's see what you can do.

> I need to set up a filter that:
> 1 - Rejects all outgoing messages if they do not specify
>     "[EMAIL PROTECTED]" in one of the headers.
> 2 - Forward a copy of all incoming messages to
>     "[EMAIL PROTECTED]" if it doesn't already appears in one of the
>     headers, and adds that address in the CC list of the message.
> [...]
> Is it possible to achieve that with the built-in big-brother option?

No.

In order to accomplish item 1, you need to use a courierfilter[1] (AKA
global mail filter), which is essentially a little daemon which listens
for connections on a Unix domain socket.  Writing your own courierfilter
in C shouldn't be too difficult, but note that there are already two
modular filter frameworks that make writing filter modules _very_ easy:
Courier::Filter[2] for Perl, and pythonfilter[3] for Python.  I don't
think Java is a good choice -- although writing a working courierfilter
daemon should be possible, its performance probably wouldn't even be
anything near that of Perl, not to mention native compiled code.

Your filter (or filter module, if you decide to use one of the modular
frameworks) would need to check the list of envelope recipients (the
headers aren't exactly authoritative as far as actual message delivery is
concerned) for the copy address, and then either return an "accept" or
"reject" result.

Be aware that courierfilters (global mail filters) cannot modify the
message.  Besides, adding a "CC:" header wouldn't get the message
delivered to the copy address anyway because it's the envelope recipients
that count (although mail clients usually derive the envelope recipients
from the headers when submitting mail).

It should be possible to add the copy address to the list of envelope
recipients from within a courierfilter.  This can be achieved by opening
the control file in append mode and appending an additional "r" control
record[4] with the copy address.  However, I'm not entirely sure this
would actually cause Courier to deliver the message to the added copy
address.  (Perhaps someone on this mailing list knows better than I do?)

> Someone told me I'm just using the wrong SMTP and that Postfix would be
> the right choiche; they also told me that even courier developers
> discourage using it as SMTP: is that true?

Obviously this is nonsense.  It is interesting however which marketing
methods the Postfix people feel a need to resort to. ;-)

References:
 1. http://www.courier-mta.org/courierfilter.html
 2. http://search.cpan.org/dist/Courier-Filter
 3. http://phantom.dragonsdawn.net/~gordon/courier-patches/courier-pythonfilter/
 4. http://www.courier-mta.org/queue.html



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to