Anatomy of a Recipe

    Recipes are basically pattern matchers (hence the need for regular expressions). A line starting with ':' marks the beginning of a recipe. It has the following format:
    	# Comments start with the hash symbol
    :0 [flags] [ : [locallockfile] ]
    * <zero or more conditions (one per line)>
    <exactly one action line>
    Trailing colon means "lock the mail file when processing." Don't bother with locallockfile since Procmail creates a temporary default. The only flags you are likely to care about are
    H — look in the message header (default)
    B — look in the message body
    Simple examples:
    # Sourceforge
    :0:
    * ^From:.*sourceforge.net.*
    | ${FORMAIL} -A"X-MyRecipe: Sourceforge" >>${BULKFOLDER}
    
    # A catcher for UM mail :0B: * (.*This note was authorized for distribution to\ University of Maryland Faculty and Staff by:\ The Office of the President.*) | ${FORMAIL} -A"X-MyRecipe: UM Mail" >>${BULKFOLDER}
    # Astro-ph: split up and fake as if it were separate messages. # Courtesy PJT. :0: * ^Subject:.*astro-ph.* | ${FORMAIL} +1 -eds | tr -s '\n'|sed -f /local/mail/astro-ph.script >> ${MAILDIR}/astro-ph
    # CARMA programmer position applicants :0: * (^Subject:.*CARMA*Programmer.*|\ ^Subject:.*Programmer - Software Development Astrophysics.*) | ${FORMAIL} -A"X-MyRecipe: CARMA job">> ${DEFAULT}
Previous page Next page