home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Previous Section Next Section

procmail

Deliver using procmail V8.7 and above

When using the procmail delivery agent, actual delivery is performed by the procmail(1) program, which can be used for local delivery. We described one use of procmail when we described the local_procmail feature (FEATURE(local_procmail)). In that example, local_procmail was tuned with LOCAL_ mc configuration macros, but here it is tuned with PROCMAIL_ mc configuration macros.

Support for the procmail delivery agent is included in your mc configuration file like this:

MAILER(`smtp')     define first
MAILER(`procmail') define second

Note that the smtp delivery agent must be defined before you can define procmail.

The procmail(1) program can be made to filter mail and even route mail to different files by changing a few configuration file rules. For example, it can be used as a delivery agent to handle inbound bounces for mailing lists by setting up a new rule in the parse rule set 0 that routes all recipients that end in -request for delivery with procmail:

LOCAL_CONFIG
Kisrequest regex -a@MATCH -request$

LOCAL_RULE_0
R $+ < @ $+ >                   $: $(isrequest $1 $) $| $1 <@$2>
R $* @MATCH $| $+ < @ $+ >      $#procmail $@ $3 $: $2
R $* $| $*                      $2

This bit of magic requires that you first declare a regex database-map type (regex) that will match any user part of an address that ends in -request. Then we use LOCAL_RULE_0 to declare three new rules in the parse rule set 0. The first tries to match -request in the address. The second detects a match and calls the procmail delivery agent. The third restores the original workspace in the event that no match was found.

This solution is only a suggestion and a starting place from which to work out your own solutions. In addition to new maps and rules, you will also have to tune the procmail delivery agent (possibly adding a U= delivery agent equate, U=), and configure the procmail program to do the right thing with the -request addresses it gets.

The defaults for the procmail delivery agent are shown in Table 20-12, along with the mc configuration macros used to alter those defaults.

Table 20-12. Defaults for the procmail delivery agent

Macro

§

Default

PROCMAIL_MAILER_ARGS

See this section

A=procmail -Y -m $h $f $u

PROCMAIL_MAILER_FLAGS

See this section

F=DFMSPhnu9

PROCMAIL_MAILER_MAX

See this section

no M= default

PROCMAIL_MAILER_PATH

See this section

P=/usr/local/bin/procmail

none

R=

R=EnvToSMTP/HdrFromSMTP

none

S=

S=EnvFromSMTP/HdrFromSMTP

none

T=

T=DNS/RFC822/X-Unix

PROCMAIL_MAILER_QGRP

Q=

no Q= default

The procmail(1) program is available from http://www.procmail.org/.

    Previous Section Next Section