The references will lead you to sites with comprehensive information well beyond what I've shown you so far (eg. see Timo Salmi). Nevertheless I'll give you some teasers to hint, if only a little, at what you can do with procmail.
- Suppose that I've been filtering as above and have satisfied myself that everything that I've been filing into my Unsolicited folder is really junk and that I can therefore safely toss it instead of filing it. If I wanted to do that I'd change my last rule to:
It's that simple to avoid unsolicited E-mail entirely -- file it in /dev/null (that's Unix sink hole you can toss garbage at).# Otherwise, it's unsolicited and I don't want it :0: /dev/null
- The examples so far involve a decision about where to file the message based on an address field (TO_ and From:) in the message header. You're not limited to just those headers. A common trick is to file "Urgent" messages based on the Subject: header:
It should be clear that you can filter your messages on any header and file the message into whatever folders you like. I might decide to file all messages from the various security mailing lists into a "Security" folder that I can browse at my leisure and keep my default folder (my INBOX) for mail that I ought to respond to quickly.:0: * ^Subject:.*urgent Urgent
- The pattern matching within procmail has all the power of Unix regular expressions. The mailing list rules I gave above can also be expressed in a single rule:
That rule says -- if any recipient header has some string (that's what `.*' means) followed by the word `cert' or the word `secure-sol' or etc. then file it in the default folder. The vertical bar separates possibilities, the round bracket groups them. The TO_ expression can be understood as a short form for `(To:|Cc:|Resent-to:|Resent-Cc:)'. If you know about Unix regular expressions you may have recognized the hat (`^') as a notation for "the beginning of line".# Some of the mailing lists I belong to. If any of the TO_ headers (To:, # Cc:, etc.) match one of them then file in my INBOX. :0: * ^TO_.*(cert|secure-sol|MICROSOFT_SECURITY|efc-talk|unisog) ${DEFAULT}
- Procmail rules can be stacked as in:
That rule says -- if the sender is Roger Watt (`rwwatt' is his userid) and the message is about "Job Interviews" then file it in my "Sensitive" folder. Stacking conditions means each condition must apply (ie. a logical and operation).:0: * ^From:.*rwwatt@ * ^Subject:.*Job Interviews Sensitive
- Procmail rules can be negated as in:
That rule says -- if the sender is not Roger Watt and the message is about "Job Interviews" then the message should be filed in my default folder (ie. my INBOX). The exclamation mark (`!') is a meta notation for the logical not operation.:0: * ! ^From:.*rwwatt@ * ^Subject:.*Job Interviews ${DEFAULT}I've only given the reader a very brief glimpse at procmail filters. Hopefully enough so you can deal with the unsolicited E-mail that arrives your way. And perhaps too some ideas about how you might manage your mail.