Procmail

Examples
This is an example showing extraction of subject: and from: fields into variables, and running a command (say) before putting the mail into the default dir. The example is pretty much stolen from Timo Salmi SUBJECT=`cat | egrep "^Subject:" | sed -re 's/^Subject: *//'` FROM=`cat | egrep "^From:" | sed -re 's/^From: *([a-zA-Z0-9 @.])/\1/'` :0c: # continue after this rule * ^Subject:[ ].+[a-z0-9] * ^From:[ ].+[a-z0-9] | say "You've got mail from ${FROM} . Subject: ${SUBJECT}." :0: ${DEFAULT}
 * 1) Accept all the rest to your default mailbox