divert(-1) # # Copyright (c) 2002 Professional Software Engineering. # All rights reserved. # # By using this file, you agree to hold the author and it's agents harmless. # # The rules provided herein are intended only to demonstrate the basic # functionality of procmail as a sendmail rule-invoked mailer. # # # divert(0) VERSIONID(`$Id: procmailhandler.m4,v 8.12 2002/02/01 12:58:08 sbs Exp $') PUSHDIVERT(-1) ifdef(`confPROCMAIL_OUBOUND_RC',, `define(`confPROCMAIL_OUBOUND_RC', `/usr/local/debug/mail/procmail/procmailrc-outbound')') ifdef(`confPROCMAIL_OUBOUND_ADDR_TRAILER',, `define(`confPROCMAIL_OUBOUND_ADDR_TRAILER', `procmail')') POPDIVERT LOCAL_RULE_0 R$* $: $>ProcmailHandler $1 # procmail filtering LOCAL_RULESETS SProcmailHandler ifdef(`confMAIL_LOGGER_MAILBOX',` R confMAIL_LOGGER_MAILBOX $@ confMAIL_LOGGER_MAILBOX R confMAIL_LOGGER_MAILBOX < @ $j . > $@ confMAIL_LOGGER_MAILBOX < @ $j . > #R confMAIL_LOGGER_MAILBOX < @ $=w . > $@ confMAIL_LOGGER_MAILBOX < @ $=w . > ') ifdef(`confCOPY_ERRORS_TO',` R confCOPY_ERRORS_TO $@ confCOPY_ERRORS_TO R confCOPY_ERRORS_TO < @ $j . > $@ confCOPY_ERRORS_TO < @ $j . > #R confCOPY_ERRORS_TO < @ $=w . > $@ confCOPY_ERRORS_TO < @ $=w . > ') # parse for local users (single token, no domain) # note that depending upon where you place the hook for this ruleset, # this may occur before or after sendmail expands aliases which may # resolve an apparent local delivery to a remote address - place your # hook as you see fit. R$- . confPROCMAIL_OUBOUND_ADDR_TRAILER $@ $1 # procmail has already looked at this R$- $#procmail $@ confPROCMAIL_OUBOUND_RC $: $1 . confPROCMAIL_OUBOUND_ADDR_TRAILER # invoke procmail # parse for canonical domains # (resolved domains will have a dot trailing the domain name) R$* < @ $+ . confPROCMAIL_OUBOUND_ADDR_TRAILER > $@ $1 < @ $2 . > # procmail has already looked at this. R$* < @ $+ . > $#procmail $@ confPROCMAIL_OUBOUND_RC $: $1 < @ $2 . confPROCMAIL_OUBOUND_ADDR_TRAILER > # invoke procmail # parse for non-resolveable canonical domains # (unresolved domains will NOT have a dot trailing the domain name) R$* < @ $+ .x`'confPROCMAIL_OUBOUND_ADDR_TRAILER > $@ $1 < @ $2 > # procmail has already looked at this. R$* < @ $+ > $#procmail $@ confPROCMAIL_OUBOUND_RC $: $1 < @ $2 .x`'confPROCMAIL_OUBOUND_ADDR_TRAILER > # invoke procmail # other examples would include filtering for a specific user address or # hostname/domain or inbound vs. outbound. divert(0)