Bernd Wurst wrote:
> Am Mittwoch, 3. Oktober 2007 schrieb Jean-Christophe Boggio:
>> I would like to reject mails when "To:" match a regex
>> (for example, I receive several mails addressed to
>> [EMAIL PROTECTED], the "number part" being random).
>> I know these are always spams.
>>
>> Is there a way to do this ?
> 
> Two ways:
> 1. Write a courierfilter. This is not that hard if you know a language where 
> an example filter exists (python => pythonfilter, perl => perlfilter).

(There are examples in C also.)

Way [1] is the only way to go if you mean _when "To:" match a regex_ strictly.

> 2. bounce or drop via a script executed by .courier files.
> 
> Last one is for sure the easiest way to go but not really a good solution.

Way [2] works with "RCPT TO" addresses. Courier first calls filters *live*
and then calls them for delivery. The solution is bad if one first accepts
the message but then bounces it, loading the server with the burden to send
all those DSNs. When filtering is consistent at both stages, the solution
is acceptably good.

For implementing consistency, I run the same shell script in both cases. For
the delivery part I have a .courier-default in aliasdir with a line invoking
the shell script via `||', so I can change the recipient if needed.

For the rcptfilter part, I have a small executable that loads the same shell
script. The small executable's full path is in the maildropfilter config file,
thus courier runs it for rcpt filtering (only.) I posted the source of the
small executable last year on this list, see
Re: [courier-users] hosteddomains and aliases capitalization
Fri, 27 Oct 2006 20:53:29 +0200
http://groups.google.it/group/mailing.unix.courier-imap/browse_frm/thread/372a9a716cc333d0/d16bb37e01dfbe8e














































-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to