Vetinari's $HOME

NAME

header_filter - filter (drop) mails based on certain header fields

DESCRIPTION

The header_filter can drop mails just by some header fields. This was written to drop mails by known spam Subject:s, but may be used to drop mails by any header fields.

CONFIG

The plugin uses the header_filter config file. This file contains lines with four (or three) fields, separated by white space. The first field is the name of the header to look at, the second field either a string or a perl regex surrounded by ``/''. Both (string/regex) are of course without any spaces inside. If you need spaces, use a regex with \s or \x20. Before matching any \t (TAB), \r (CR) and \n (LF) are replaced by a space (" "). Strings are compared case sensitive, regexes case insensitive.

Any $RCPT, $RCPT_HOST, $RCPT_USER in a regexp will be replaced by the first recipient's address, host part of address, local part of address. Same for $FROM, $FROM_HOST, $FROM_USER.

The third field is a (valid) return constant from Qpsmtpd::Constants. Lines with invalid constants are ignored and OK or DONE are mapped to DECLINED.

The last optional field (which may contain spaces) is the message which is returned with the constant to qpsmtpd if the regex (or string) matches.

EXAMPLE

 Subject /^Re:(\s*\d+)?\s+V\S*A\S*GH?RA\s*$/   DENY Spam... detected
 Subject /^(It's\s+\S+|\S+\s+here)\s+\:\)\s*$/ DENY Spam... detected
 Subject Hi                                    DENY Spam... detected
 ## only use if you're the only MX for $RCPT_HOST and your hostname is
 ## not $RCPT_HOST!
 Received /^from.*by\s+$RCPT_HOST\s+with\s+esmtp.*for\s+$RCPT\s*;/ DENY Spam

COPYRIGHT AND LICENSE

Copyright (c) 2006 Hanno Hecker

This plugin is licensed under the same terms as the qpsmtpd package itself. Please see the LICENSE file included with qpsmtpd for details.