procmail

Deliver using procmail V8.7 and later

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 FEATURE(local_procmail) (FEATURE(local_procmail) on page 627). 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 on page 932) 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 ...

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.