shredmail example

syntien edited this page Oct 26, 2014 · 10 revisions

Called from /etc/procmailrc

SHREDMAIL=/usr/local/bin/shredmail

#
# filter through spamassassin
#
:0fw
        | /usr/bin/spamc

#
# shred known spam
#
:0
* ^X-Spam-Flag:.*YES
        | $SHREDMAIL "Spam"

#
# use shredmail to log normal delivery
#
:0
{ RSP=`$SHREDMAIL -s Sent "Ham"` }

When called from a delivering recipe, as in the first usage, shredmail will consume the mail message.

When called from a non-delivering recipe, as in the second usage, the mail message is still available for further processing and delivery. Along with the -s flag, this provides a means of logging the status and/or disposition of the mail message.

Resulting /var/log/maillog

Apr  3 10:25:52 secure postfix/smtpd[7343]: AFB03407E3: client=unknown[185.12.14.199]
Apr  3 10:25:52 secure postfix/cleanup[7346]: AFB03407E3: message-id=<93d0849bd982f4d6768f30d0799c26b3@spammer.example.com>
Apr  3 10:25:52 secure postfix/qmgr[2647]: AFB03407E3: from=<DisabilityClaimHelp-syntien=example.com@spammer.example.com>, size=6656, nrcpt=1 (queue active)
Apr  3 10:25:54 secure shredmail[7352]: AFB03407E3: user=syntien status=Shredded info=Spam
Apr  3 10:25:54 secure postfix/local[7347]: AFB03407E3: to=<syntien@example.com>, orig_to=<syntien@example.com>, relay=local, delay=1.4, delays=0.27/0.01/0/1.2, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail)
Apr  3 10:25:54 secure postfix/qmgr[2647]: AFB03407E3: removed

Apr  3 10:26:04 secure postfix/smtpd[11015]: 54BB4403B3: client=unknown[192.168.194.134]
Apr  3 10:26:04 secure postfix/cleanup[11280]: 54BB4403B3: message-id=<20141026205856.54BB4403B3@example.com>
Apr  3 10:26:06 secure shredmail[11289]: 54BB4403B3: user=syntien status=Sent info=Ham
Apr  3 10:26:06 secure postfix/local[11283]: 54BB4403B3: to=<syntien@example.com>, orig_to=<syntien@example.com>, relay=local, delay=1.4, delays=0.27/0.01/0/1.2, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail)
Apr  3 10:26:06 secure postfix/qmgr[1254]: 54BB4403B3: removed
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.