########################################################################
# Procmailrc example file
#
# By Chris Fuhrman <cfuhrman@pobox.com>
#
# $Id: procmailrc.txt 190 2020-08-08 17:17:34Z cfuhrman $
#
# Feel free to modify this file to your liking.  Please
# report any bugs/etc to me at the above address

# Initialize some general-use variables
SHELL          = /bin/sh

# These variables are needed by Procmail itself
PMDIR          = $HOME/.procmail
LOGFILE        = $PMDIR/log
VERBOSE        = off
LINEBUFF       = 4096

# Default Program and File Locations
MAILDIR        = $HOME/mail
FORMAIL        = /usr/bin/formail
ADMINFOLDER    = in-admin

#=======================================================================#
# General Use Recipes
#

# Create a backup cache of 20 most recent messages
:0 c
backup

  :0 ic
  | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,20d`

# Regenerate "From" lines to make sure they are valid
:0 fhw
| $FORMAIL -I "From " -a "From "

# Send bounced mail and mail from admin accounts to its own folder
:0:
* (^FROM_MAILER|\
   ^From.*[^0-9A-Za-z]abuse@|\
   ^From.*[^0-9A-Za-z]spam@)
| $FORMAIL -A"X-Sorted: Admin" >>$ADMINFOLDER