# $NetBSD: sample-pcre-header.cf,v 1.3 2003/03/08 19:43:58 perry Exp $ # # # Sample pcre (PERL-compatible regular expression) map file for # message header filtering. See pcre_table(5) for syntax description. # # Message headers are filtered one at a time. This filter understands # multi-line message headers, including MIME headers in the message # body. # # The first field is a perl-like regular expression. The expression # delimiter can be any character except whitespace, or characters # that have special meaning to the regexp library (traditionally # the forward slash is used). The regular expression can contain # whitespace. # # By default, matching is case-INsensitive, although following # the second slash with an 'i' will reverse this. Other flags are # supported, but the only other useful one is 'U', which makes # matching ungreedy (see PCRE documentation and source for more # info). # # A block of table entries may be "enclosed" by a line with # `if /pattern/flags' and a line with `endif'. This causes # the block of table entries to be examined only when the # pattern produces a successful match. The `if..endif' may # be nested. There currently is no `else' operator. # # The second field is the "replacement" string - the text # returned by the match. # # REJECT [optional text...] # Reject the entire message. The optional text is sent to # the originator and is logged to the maillog file. # IGNORE Silently ignore the message header. # WARN [optional text...] # Log the message header and the optional text. This is # useful for testing. When the pattern is OK, change the # WARN into a REJECT or into a DISCARD. # HOLD [optional text...] # Place the message on the hold queue. Mail on hold can # be inspected with the postcat command, and can be # destroyed or taken off hold (i.e. delivered) with the # postsuper command. The matched header is logged # together with the optional text. # DISCARD [optional text...] # Claim successful delivery and silently discard the # message. The matched header is logged together with # the optional text. # FILTER transport:nexthop # After the message is queued, send the entire # message through a content filter. This # requires different cleanup servers before # and after the filter, with header/body # checks turned off in the second cleanup # server. More information about content filters # is in the Postfix FILTER_README file. This feature # overrides the main.cf content_filter setting. # # Substitution of sub-strings from the matched expression is # possible using the conventional perl syntax. The macros in the # replacement string may need to be protected with curly braces # if they aren't followed by whitespace (see the examples # below). # # Lines starting with whitespace are continuation lines - they are # appended to the previous line (there should be no whitespace # before your regular expression!) # /^Subject: Make Money Fast/ REJECT /^To: friend@public.com/ REJECT