CATS2PROCMAILRC(1) User Contributed Perl Documentation CATS2PROCMAILRC(1) NAME cats2procmailrc - generate a procmail recipe from my mail categories file SYNOPSIS cats2procmailrc [-D] [-L] [-a alert] [-m maildomains] [-t type] [-T] procmailrc DESCRIPTION cats2procmailrc reads a human friendly mail category description file and emits a matching procmail(1) recipe to implement it. The intent is to have an extremely succinct file of easily editable one line rules, generally of the form: folder tag pattern I build my .procmailrc like this: cats2procmailrc \ -a 'announce-email "+%"' \ -t mh -L \ -m cskk.homeip.net \ $HOME/.procmailrc OPTIONS -D Insert a variation on the standard formail(1) recipe for deleting duplicates on a per-folder basis. For MH and Maildir folders, use a .msgid.cache file within the folder, otherwise use the file MAILDIR/.msgid.cache-folder. -L Put the tag into the X-Label header field instead of as a prefix to the subject line. -a alert Specify a shell command to run as the alert function (see "FILE FORMAT" below), such as mailblink(1). The character percent ('%') is replaced by the folder name. -m maildomains Specify the default mail domain for rule addresses lacking an @domain. The default comes from the environment variable $MAILDO- MAIN. In fact this may be a list of domains if you have some equvalents, separated by commas. -t type Specify the default mailbox type. If the mailbox exists the type is deduced automatically, but otherwise uses this default, which may be one of unix, maildir or mh. The default is unix. -T Don't track rule matches. Normally a "X-Cats2Procmailrc-Match- ing-Rule" header is inserted describing the match rule. This is done with formail and so can incur a noticable penalty if slow machines with lots of messages. If you're using the -L option the labels will mostly track stuff for you anyway. FILE FORMAT LINE FORMAT Blank lines and lines beginning with an octothorpe ('#') are ignored. Lines of the form: VARIABLE=value are passed through unchanged. Lines of the form: < filename interpolate raw procmailrc files. Lines of the form: << filename interpolate category files. Other lines are of the form: [+][!]folder tag pattern [+][!]who@where tag pattern [+][!]|progname tag pattern A leading plus sign ('+') means that this rule should be a continue rule, and not abort processing. A leading exclaimation mark ('!') means that mail items matching this rule should generate an alert. The alert can be any action you desire, such as the mailblink(1) command; see the -a option. For me, this means a single line summary of the mail item appears in yellow in a small log window I have at the top of my screen for mail items I should read now. The folder names the folder in which to place the mail item. Normal UNIX mail files, MH style directories and Maildir style directories are autodetetected. If the folder contains an "at" (@) character it is considered an email address and the mail item is forwarded to that address instead of being dropped in a folder. If instead of a folder a pipe (`|') and a program name are used then the message is piped to the specified program. The tag is supplied as the sole command line argument to the progname, unless the tag is "." in which case it is omitted. The tag is placed at the start of the mail's Subject line for ready recognition in mixed folders unless the -L option is used, in which case it is placed in the X-Label: header line. The special tag dot (".") suppresses this action. The pattern selects the mail items. The folder or who@where or |progname may be enclosed in double quotes if desired, for example if the folder name or program invocation con- tains whitespace. Note that the quotes do not enclose the leading "+" or "!". Example Patterns Firstly, the special pattern "." always matches. It's intended as a placeholder for ``continue'' rules that should always fire, typically to feed every mail item to a program. The usual form is simply an address (see RFC822 and RFC2822) to be present in the To, CC or BCC header lines. If the address string lacks an at ("@") then an at ("@") and the value of the environment variable $MAILDOMAIN is appended. So I have rules like this: !attn Personal cs !attn Personal cameron@cskk.homeip.net attn EFF-Cafe-News cafe-news@eff.org crypto AUCrypto aucrypto@suburbia.net matching cs@zip.com.au, cameron@cskk.homeip.net, cafe-news@eff.org and aucrypto@suburbia.net respectively. The "Personal" items generate an alert. It is also possible to select on a different header line by prefixing the pattern string with a header name, viz: applix ApplixWare sender:owner-applixware-list@applix.com which selects for an address in the Sender header line. The pattern may also be an arbitrary regular expression in egrep(1) syntax. In this case the pattern starts with a slash ("/") and option- ally ends in a slash, viz: !adzap AdZap subject:/(noads|add?[- s]*zap|squid_?redir|zapp(er|ing)|wrapzap)/ which matches mail items with subjects regarding my adzap program. A typical use of the "at" sign is in conjunction with the plus sign above to copy particular mail items to another account while still delivering locally. For example: +fred@that.isp.com . fred@this.isp.com fredmail Fred fred@this.isp.com to accept mail aimed at fred@this.isp.com and also copy it to fred@that.isp.com. ENVIRONMENT MAILDIR, the directory containing mail folders. MAILDOMAIN, the local mail domain (eg cskk.homeip.net for my home domain). SEE ALSO procmail(1), procmailrc(1), procmailex(1), egrep(1) AUTHOR Cameron Simpson perl v5.8.4 2004-10-08 CATS2PROCMAILRC(1)