home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / mail / procmail / tips-pointer < prev   
Encoding:
Internet Message Format  |  2004-05-05  |  20.6 KB

  1. Path: senator-bedfellow.mit.edu!dreaderd!not-for-mail
  2. Message-ID: <mail/procmail/tips-pointer_1083675484@rtfm.mit.edu>
  3. Supersedes: <mail/procmail/tips-pointer_1082292761@rtfm.mit.edu>
  4. Expires: 2 Jun 2004 12:58:04 GMT
  5. X-Last-Updated: 2002/07/11
  6. Organization: none
  7. From: <jari.aalto@poboxes.com> (Jari Aalto+mail.procmail)
  8. Subject: Procmail tips page pointer
  9. Summary: This mail contains pointer to Procmail Tips page
  10.   at http://www.procmail.org/ which answers most of your procmail
  11.   questions about recipes, handling spam, autoreply, calling shell programs
  12. Newsgroups: comp.mail.misc,comp.answers,news.answers
  13. Approved: news-answers-request@MIT.EDU
  14. Followup-To: comp.mail.misc
  15. Precedence: bulk
  16. Originator: faqserv@penguin-lust.MIT.EDU
  17. Date: 04 May 2004 13:01:16 GMT
  18. Lines: 460
  19. NNTP-Posting-Host: penguin-lust.mit.edu
  20. X-Trace: 1083675676 senator-bedfellow.mit.edu 566 18.181.0.29
  21. Xref: senator-bedfellow.mit.edu comp.mail.misc:79465 comp.answers:57061 news.answers:270894
  22.  
  23. Archive-name: mail/procmail/tips-pointer
  24. Posting-Frequency: 2 times a month
  25. Maintainer: Jari Aalto <jari.aalto@poboxes.com>
  26. Last-Modified: $Docid: 2002-07-11 Jari Aalto $
  27.  
  28. Announcement: "Procmail tips page: all you wanted to know about procmail"
  29.  
  30.     Faq archive is at:
  31.  
  32.         http://www.faqs.org/faqs/
  33.  
  34.     The Procmail documentation project is at
  35.  
  36.         http://pm-doc.sourceforge.net/
  37.  
  38.     Other procmail documents
  39.  
  40.         Era's exellent procmail pages (including procmail faq) are at:
  41.  
  42.             http://www.iki.fi/~era/procmail
  43.  
  44.         Another exellent email filtering tips and recipes (procmail)
  45.         Page by Prof. Timo Salmi at
  46.  
  47.             http://www.uwasa.fi/~ts/info/proctips.html
  48.  
  49.     What is Procmail?
  50.  
  51.         Procmail is a mail processing utility, which can help you
  52.         filter your mail; sort incoming mail according to sender, Subject
  53.         line, length of message, keywords in the message, etc; implement an
  54.         ftp-by-mail server, and much more. Procmail is also a complete
  55.         drop-in replacement for your MDA. (If this doesn't mean anything to
  56.         you, you don't want to know.)
  57.  
  58.         Procmail runs under Unix. See Infinite Ink's Mail Filtering and
  59.         Robots page for information about related utilities for various other
  60.         platforms, and competing Unix programs, too (there aren't that many
  61.         of either).
  62.  
  63.     Description
  64.  
  65.         The procmail tips page contains collection of procmail recipes,
  66.         instructions, howtos. The document also contains URL pointers to
  67.         the procmail mailing list and sites that fight against Internet
  68.         UBE. You will also find many other interesting subjects that
  69.         discuss about internet email: haeders and RFCs.
  70.  
  71.         The tips are compiled from the procmail discussion list,
  72.         from comp.mail.misc and from the author's own experiences with
  73.         procmail.
  74.  
  75.         This document does not teach you basics of procmail; instead you
  76.         have to be familiar with the procmail man pages already before this
  77.         document's tips are useful to you.
  78.  
  79. Table of contents as of 2002-07-11
  80.  
  81.        1.0 Document id
  82.            1.1 General
  83.            1.2 What is Procmail?
  84.            1.3 Abbreviations and thanks
  85.            1.4 Version information
  86.            1.5 Document layout and maintenance
  87.               1.5.1 Sending improvements
  88.            1.6 About presented recipes
  89.            1.7 Variables used in recipes
  90.            1.8 About "useless use of cat award"
  91.  
  92.        2.0 Procmail pointers
  93.            2.1 Where is procmail developed
  94.            2.2 About procmail's Y2K compliance
  95.            2.3 Procmail resources
  96.            2.4 Procmail mode for Emacs
  97.            2.5 Procmail module library project
  98.               2.5.1 Where to get the modules
  99.               2.5.2 Terminology
  100.               2.5.3 Foreword to using modules
  101.               2.5.4 Header file modules
  102.               2.5.5 General modules
  103.               2.5.6 Low-level Date and time handling
  104.               2.5.7 Higher-level Date and time handling
  105.               2.5.8 Forwarding and account modules
  106.               2.5.9 Vacation modules
  107.               2.5.10 Message-id based modules
  108.               2.5.11 Cron modules
  109.               2.5.12 Backup modules
  110.               2.5.13 Confirmation modules
  111.               2.5.14 File Servers
  112.               2.5.15 Mime modules
  113.               2.5.16 Filtering message body or headers
  114.               2.5.17 Miscellaneous modules
  115.               2.5.18 Mailing list modules
  116.            2.6 Procmail code to filter UBE
  117.  
  118.        3.0 Dry run testing
  119.            3.1 What is dry run testing
  120.            3.2 Why the From field is not okay after dry run
  121.            3.3 Getting default value of a procmail variable
  122.  
  123.        4.0 Things to remember
  124.            4.1 Get the newest procmail
  125.            4.2 Csh's tilde is not supported
  126.            4.3 Be sure to write the recipe starting right
  127.            4.4 Always set SHELL
  128.               4.4.1 If system has no /bin/sh and you're forced to use csh/tcsh
  129.               4.4.2 Procmail won't work well with SHELL set to csh derivate
  130.            4.5 Check and set PATH
  131.            4.6 Keep the log on all the time
  132.            4.7 Never add a trailing slash for directories
  133.            4.8 Remember what term DELIVERED means
  134.            4.9 Beware putting comment in wrong place
  135.            4.10 Brace placement
  136.            4.11 Local lockfile usage
  137.            4.12 Global lockfile
  138.            4.13 Gee, where do I put all those ! * $ ??
  139.            4.14 Sending automatic reply, use X-loop header
  140.            4.15 Avoid extra shell layer (check command for SHELLMETAS)
  141.            4.16 Think what shell commands you use
  142.            4.17 Using absolute paths when calling a shell program
  143.            4.18 Disabling a recipe temporarily
  144.            4.19 Keep message backup, no matter what
  145.            4.20 Order of the procmail recipes
  146.  
  147.        5.0 Procmail flags
  148.            5.1 The order of the flags
  149.            5.2 Flag w and recipe with |
  150.            5.3 Flag w, lock file and recipe with |
  151.            5.4 Flag f and w together
  152.            5.5 Flags h and b
  153.            5.6 Flag h and sinking to /dev/null
  154.            5.7 Flag i and pipe flag f
  155.            5.8 Flag r
  156.            5.9 Flag c's background
  157.            5.10 Flag c before nested block forks a child
  158.            5.11 Flag c and understanding possible forking penalty
  159.            5.12 Flags before nested block
  160.            5.13 Flags aAeE tutorial
  161.  
  162.        6.0 Matching and regexps (regular expressions)
  163.            6.1 Philosophy of abstraction in regexps
  164.            6.2 Matches are not case-sensitive
  165.            6.3 Procmail uses multi line matches
  166.            6.4 Headers are unfolded before matching
  167.            6.5 Improving Space-Tab syndrome
  168.            6.6 Handling exclamation character
  169.            6.7 Rules for generating a character class
  170.            6.8 Matching space at the end of condition
  171.            6.9 Beware leading backslash
  172.            6.10 Correct use of TO Macro
  173.            6.11 Procmail's regexp engine
  174.            6.12 Procmail and egrep differences
  175.            6.13 Understanding procmail's minimal matching (stingy vs. greedy)
  176.            6.14 Explaining \/ and ()\/
  177.            6.15 Explaining  ^^ and ^
  178.            6.16 ANDing traditionally
  179.            6.17 ORing traditionally
  180.            6.18 ORing and score recipe
  181.            6.19 ORing by using De Morgan rules
  182.  
  183.        7.0 Variables
  184.            7.1 Setting and unsetting variables
  185.            7.2 Variable initialization and sh syntax
  186.            7.3 Testing variables
  187.            7.4 What does $\VAR mean?
  188.            7.5 Common pitfalls when using variables
  189.            7.6 Quoting: Using single or double quotes
  190.            7.7 Quoting: Passing values to an external program
  191.            7.8 Passing values from an external program
  192.            7.9 Incrementing a variable by a value N
  193.            7.10 Comparing values
  194.            7.11 Strings: How many characters are there in a given string?
  195.            7.12 Strings: How to strip trailing newline.
  196.            7.13 Strings: deriving the last N characters of a string.
  197.            7.14 Strings: Getting partial matches from a string.
  198.            7.15 Strings: Procmail string manipulation example
  199.            7.16 How to raise a flag if the message was filed
  200.            7.17 Dollar sign in condition lines.
  201.            7.18 Finding mysterious foo variable
  202.            7.19 Storing code to variable
  203.            7.20 Getting headers into a variable.
  204.            7.21 Converting value to lowercase
  205.  
  206.        8.0 Suggestions and miscellaneous
  207.            8.1 Speeding up procmail
  208.            8.2 See the procmail installation's examples
  209.            8.3 Printing statistics of your incoming mail
  210.            8.4 Storing UBE mailboxes outside of quota
  211.            8.5 Using first 5-30 lines from the message
  212.            8.6 Using cat or echo in scripts?
  213.            8.7 How to run an extra shell command as a side effect?
  214.            8.8 Forcing "ok" return status from shell script
  215.            8.9 Make your own .procmailrc available to others
  216.            8.10 Using dates efficiently
  217.            8.11 Keep simple header log
  218.            8.12 Gzipping messages
  219.            8.13 Emergency stop for your .procmailrc
  220.  
  221.        9.0 Scoring
  222.            9.1 Using scores by an example
  223.            9.2 Brief Score tutorial
  224.            9.3 Score's scope
  225.            9.4 Counting length of a string
  226.            9.5 Counting lines in a message (Adding Lines: header)
  227.            9.6 Determining if body is longer than header
  228.            9.7 Matching last Received header
  229.            9.8 How to add Content-Length header
  230.            9.9 Testing message size or number of lines
  231.            9.10 Counting commas with recursive includerc
  232.  
  233.        10.0 Formail usage
  234.            10.1 Fetching fields with formail -x
  235.            10.2 Always use formail's -rt switch
  236.               10.2.1 For procmail versions prior 3.14
  237.            10.3 Using -rt and rewriting the From address
  238.            10.4 Formail -rt and Resent-From header
  239.            10.5 Quoting the message
  240.            10.6 Without quoting the message
  241.            10.7 How to include headers and body to the reply message
  242.            10.8 Adding text to the beginning of message
  243.            10.9 Adding text to the end of message
  244.            10.10 Adding text before quoted message
  245.            10.11 Adding extra headers from file
  246.            10.12 Splitting digest
  247.            10.13 Mailbox: Splitting to individual files
  248.            10.14 Mailbox: Extracting all From addresses from mailbox
  249.            10.15 Mailbox: Applying procmail recipe on whole mailbox
  250.            10.16 Mailbox: run series of commands for each mail (split mailbox)
  251.            10.17 Option -D and cache
  252.            10.18 Option -D and message-id in the body
  253.            10.19 Reducing formail calls (conditionally adding fields)
  254.            10.20 Formail -A -a options
  255.            10.21 Formail -e -s options
  256.  
  257.        11.0 Saving mailing list messages
  258.            11.1 Using subroutine pm-jalist.rc to detect mailing lists
  259.            11.2 Using plus addressing foo+bar@address.com
  260.            11.3 Using RFC comment trick for additional information
  261.            11.4 Simple mailing list handling
  262.            11.5 Archiving according to TO
  263.            11.6 Using Return-Path to detect mailing lists
  264.  
  265.        12.0 Procmail, MIME and HTML
  266.            12.1 Mime Bibliography
  267.            12.2 Mime notes
  268.            12.3 Software to deal with mime or HTML
  269.            12.4 Mime content type application/ms-tnef
  270.            12.5 Trapping HTML mime messages
  271.            12.6 Complaining about HTML messages
  272.            12.7 Converting HTML body to plain text
  273.            12.8 Getting rid of unwanted mime attachments (HTML, vcard)
  274.            12.9 Sending contents of a HTML page in plain text to someone
  275.  
  276.        13.0 Simple recipe examples
  277.            13.1 Saving: MH folders -- numbered messages
  278.            13.2 Saving: to monthly folders
  279.            13.3 Modifying: Filtering basics
  280.            13.4 Modifying: Squeezing empty lines around message body
  281.            13.5 Modifying: shuffling headers always to same order
  282.            13.6 Service: Auto answerer to empty messages
  283.            13.7 Service: File server -- send file as attachments upon request
  284.            13.8 Service: Ping responder
  285.            13.9 Service: simple vacation with procmail
  286.            13.10 Service: vacation code example
  287.            13.11 Service: Auto-forwarding
  288.            13.12 Service: forward only specific messages
  289.            13.13 Service: Making digests
  290.            13.14 Kill: killing advertisement headers and footers
  291.            13.15 Kill: simple kill file recipe with procmail
  292.            13.16 Kill: duplicate messages
  293.            13.17 Kill: spam filter with simple recipes
  294.            13.18 Kill: (un)subscribe messages
  295.            13.19 Time: Once a day cron-like job
  296.            13.20 Time: Running a recipe at a given time
  297.            13.21 Time: Triggering mail and using cron
  298.            13.22 Decoding: Uudecode
  299.            13.23 Decoding: MIME
  300.            13.24 How to send commands in the message's body
  301.            13.25 Matching two words on a line, but not one
  302.            13.26 How to define personal XX macros?
  303.            13.27 How to change subject by body match
  304.            13.28 How to change Subject according to some other header
  305.            13.29 How to call program with parameters
  306.  
  307.        14.0 Miscellaneous recipes
  308.            14.1 Matching valid Message-Id header
  309.            14.2 Sending two files in a message
  310.            14.3 Excessive quoting of message
  311.            14.4 Sending message to pager in chunks
  312.            14.5 Playing particular sound when message arrives
  313.            14.6 Combining multiple Original-Cc and Original-To headers
  314.            14.7 Forwarding sensitive messages in encrypted format
  315.  
  316.        15.0 Procmail and PGP
  317.            15.1 Decrypt pgp messages automatically
  318.            15.2 Getkeys from key server
  319.            15.3 Auto grab incoming pgp keys
  320.  
  321.        16.0 Includerc usage
  322.            16.1 Using: multiple rc files
  323.            16.2 Using: You can call rc file conditionally
  324.            16.3 Autoloading an rc file
  325.            16.4 Making: naming of the rc file
  326.            16.5 Making: Using name space when saving procmail variables
  327.            16.6 Making: Public and private variables in rc file
  328.            16.7 The rules of thumb for constructing general purpose rc file
  329.            16.8 An includerc skeleton
  330.  
  331.        17.0 Mailing list server
  332.  
  333.        18.0 Common troubles
  334.            18.1 Procmail modes: normal, delivery, and mail filter.
  335.            18.2 Procmail as sendmail Mlocal mail filtering device
  336.            18.3 Procmail doesn't pass 8bit characters
  337.            18.4 My ISP isn't very interested in installing procmail
  338.            18.5 My ISP has systemwide procmailrc; is this a good idea?
  339.            18.6 Procmail changes mailbox and directory permissions
  340.            18.7 Changing mbox permission during compilation to 660
  341.            18.8 The .forward file must be real file
  342.            18.9 Using .forward if procmail already is LDA
  343.            18.10 Mail should be put in the mailqueue if write fails
  344.            18.11 Qmail: how to make it work with procmail
  345.            18.12 Qmail: Procmail looks file from /var/spool/mail only
  346.            18.13 Qmail: patch to procmail 3.11pre7 to work with Maildirs
  347.            18.14 AFS: How to use Procmail when HOME is in AFS cell
  348.            18.15 Help, some idiot sent my address to 30 mailing lists
  349.            18.16 Help, Procmail beeps and prints to my console
  350.            18.17 Help, procmail dumps mail to console
  351.            18.18 Help, corrupted From_ line in mailbox
  352.            18.19 Directing user's mail to HOME instead of /var/spool/
  353.            18.20 NFS mounting /var/mail is a good way to get bad performance
  354.            18.21 I can't see the sendmail's response in LOGFILE
  355.            18.22 Compiling procmail and choosing locking scheme
  356.            18.23 Forwarding lot of mail causes heavy load
  357.            18.24 What happens to mail if MDA Procmail fails
  358.            18.25 Procmail reads entire 90Mb message into memory
  359.            18.26 Help, procmail uses occasionally huge chunk of memory
  360.            18.27 Procmail signaled out of memory in my verbose log
  361.            18.28 Variables DEFAULT and ORGMAIL
  362.            18.29 When DEFAULT cannot be mailed to
  363.            18.30 Variable DROPPRIVS
  364.            18.31 Variable HOME
  365.            18.32 Variable HOST
  366.            18.33 Variable LINEBUF
  367.            18.34 Variable LOG and LOGFILE
  368.            18.35 Variable TRAP
  369.            18.36 Variable UMASK
  370.            18.37 UMASK and permissions
  371.            18.38 Performance difference between back tick and "|" recipe
  372.            18.39 Procmail's temporary file names while writing file out
  373.            18.40 Parameter $@
  374.            18.41 Procmail variables are null terminated (detecting null string)
  375.            18.42 FROM_DAEMON TO and TO_ and case-sensitiveness
  376.            18.43 TO_ macro deciphered
  377.            18.44 TO_ macro and RFC 822
  378.            18.45 FROM_DAEMON deciphered
  379.  
  380.        19.0 Technical matters
  381.            19.1 List of exit codes
  382.            19.2 List of precedence codes
  383.            19.3 Sendmail and -t
  384.            19.4 RFC822 Reply-To and formail problem with multiple recipients
  385.            19.5 Procmail and IMAP server
  386.            19.6 Machine which processes mail
  387.            19.7 Compiling procmail and MAILSPOOLHOME
  388.  
  389.        20.0 Smartlist
  390.            20.1 MLM RFC
  391.            20.2 Other mailing list software
  392.            20.3 SmartList code (mailing list implementation with procmail)
  393.            20.4 Installation trouble: getparams
  394.            20.5 Accepting mail only from users in whitelist(s)
  395.  
  396.        21.0 Additional procmail or MUA software
  397.            21.1 Comstat to handle multiple mailboxes
  398.            21.2 Elm and pgp support (Mutt is the successor to elm.)
  399.            21.3 MH sites
  400.  
  401.        22.0 Additional procmail software for Emacs
  402.            22.1 What is Emacs
  403.            22.2 Emacs and procmail mode and Lint
  404.            22.3 Emacs and lining up backslashes
  405.            22.4 Emacs and browsing mailbox files
  406.            22.5 Emacs and live-mode.el
  407.            22.6 Emacs and font-lock.el
  408.  
  409.        23.0 Procmail, Emacs and Gnus
  410.            23.1 Gnus pointers
  411.            23.2 Why use procmail with Gnus
  412.            23.3 Setting up gnus for procmail - Basics
  413.            23.4 Gnus for procmail - More gnus
  414.            23.5 Emacs and Gnus -- Fiddling with spool files
  415.            23.6 Gnus and article snippets
  416.            23.7 Emacs GNUS - POP - Procmail
  417.  
  418.        24.0 RFC, Request for comments
  419.            24.1 RFCs and their jurisdiction (munged Addresses)
  420.            24.2 Comments about addresses munging
  421.            24.3 RFC and valid mail address characters
  422.            24.4 RFC and login-name@fdqn
  423.            24.5 RFCs and messages signature
  424.            24.6 RFC and using MIME in Usenet newsgroups
  425.            24.7 Some RFC Pointers
  426.  
  427.        25.0 Introduction to E-mail Headers
  428.            25.1 To find out more about mail (Resources)
  429.            25.2 Lecture by Alan Stebbens
  430.            25.3 Applied to received messages
  431.            25.4 Bcc lecture by Alan Stebbens
  432.            25.5 Bcc lecture by Philip Guenther
  433.  
  434.        26.0 Message headers
  435.            26.1 What is correct From address syntax
  436.            26.2 What's that X-UIDL header?
  437.            26.3 What is that first From_ header?
  438.            26.4 Message-Id header
  439.            26.5 Received header
  440.            26.6 Return-Path
  441.            26.7 Errors-To
  442.            26.8 X-Subscription-Info
  443.            26.9 Reply-To header
  444.            26.10 Mail-Copies-To header
  445.            26.11 Mail-Followup-To and Reply-To-Personal headers
  446.            26.12 Content-Length header and From_ specification
  447.            26.13 Moral about CC copies in Usenet
  448.  
  449.        27.0 Other interesting code
  450.            27.1 Misc mail related pointers
  451.            27.2 Expire mail pointers
  452.            27.3 Usenet News related pointers
  453.            27.4 Code: Perl Extract procmail man pages from 3.11pre7.tar.gz
  454.            27.5 Code: Sh remove matching lines from file
  455.  
  456.        28.0 UBE in Internet
  457.            28.1 Terms used and foreword
  458.            28.2 UBE strategies
  459.               28.2.1 4g. I asked to be "removed" - guess what? I got another U*E
  460.               28.2.2 4h. I asked to be "removed" - guess what? The message bounced
  461.            28.3 UBE and bouncing message back
  462.            28.4 UBE and "I don't mind" attitude
  463.            28.5 We need a law against UBE
  464.  
  465.        29.0 Anti-UBE pointers
  466.            29.1 NoCEM, CAUCE and others
  467.            29.2 General Filtering pages (more than procmail)
  468.            29.3 Junk mail and spam
  469.            29.4 Comprehensive list of spammers
  470.            29.5 Misc pointers
  471.            29.6 Questionable UBE stop services
  472.            29.7 UBE related newsgroups or mailing lists
  473.            29.8 Software: the net abuse page
  474.            29.9 Software: adcomplain -- Perl junk mail report
  475.            29.10 Software: Ricochet -- Perl junk mail report
  476.            29.11 Software: yell -- perl
  477.            29.12 Software: RBL lookup tool -- C
  478.            29.13 Software: mapSoN
  479.            29.14 Software: spamgard
  480.            29.15 Software: Spam Be Gone
  481.            29.16 Software: TinyGnus - Emacs Gnus plug-in
  482.  
  483.