Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Filtering Mail FAQ
Section - 4.1 Setting up Filter

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Counties ]


Top Document: Filtering Mail FAQ
Previous Document: 4.0 Filter
Next Document: 4.2 Tracking Your Incoming Mail
See reader questions & answers on this topic! - Help others by sharing your knowledge

1] Find out if filter is on your system and what the full path to it is.  
   If you are using the C shell (csh) type:

     which filter

   Or, if you are using the Korn shell (ksh) or the Bourne shell (sh) type:

     type filter

   If neither ``which'' nor ``type'' are on your system try ``where'' and
   ``whereis''.  If your system doesn't have filter ask your system 
   administrator to install it; or even better ask her to install procmail.


2] Note the full path of your home directory by typing:

     cd
     pwd


3a] Create ~/.elm/filter-rules.  (Note that throughout this article I use
    pico for editing files.  Replace ``pico'' with your editor.)

     cd
     mkdir .elm
     cd .elm
     pico filter-rules

  
3b] Enter a modified version of the following in your ~/.elm/filter-rules

     if (subject contains "test") then save "/j/nancym/Mail/IN.testing"
   
   Replace /j/nancym with your home directory path (see step 2).
   Replace /Mail with the name of the directory where your mail folders are
   stored.  Pine and Berkeley Mail use /mail (lower case m) and Elm uses 
   /Mail (upper case M).
   

4] To see what the filter rule will do type the following at your Unix 
   prompt:  

     filter -r


5a] Create a ~/.forward file by typing the following. (Pico's -w flag tells 
    pico not to auto wrap lines.)

      cd
      pico -w .forward


5b] Enter a modified version of the following in your ~/.forward:


     "|/usr/local/bin/filter -o /j/nancym/.elm/filter-errors"


    == IMPORTANT NOTES ==
    * Make sure you include the quotes (").
    * The vertical bar (|) is a pipe.
    * Replace /usr/local/bin with the correct path for filter (see step 1).
    * Replace /j/nancym with your home directory (see step 2).
   
    * Do NOT expect environment variables, like $HOME, to work in your 
      .forward file.
    * Do NOT expect ~ to mean your home directory in the .forward file.


5c] Note that on many systems you need to make your .forward is world 
    readable and your home directory world searchable in order for the
    mail transport agent to "see" it.  To do this type:
   
      cd
      chmod 644 .forward
      chmod a+x .


6] Send yourself two test messages: one with ``test'' in the subject
   and one without ``test'' in the subject.


7a] Start your mailer (pine, elm, etc.) and check that the messages
    were delivered correctly.  The one with ``test'' in the subject
    should be in the folder IN.testing and the one without ``test'' 
    in the subject should be in your inbox.  If these were delivered 
    correctly go on to step 8.


7b] TROUBLESHOOTING
    * If the two messages were not delivered correctly look at your
      ~/.elm/filter-errors to see if you can determine what the problem 
      is.  

    * Check these two files for typos:
        ~/.forward
        ~/.elm/filter-rules

    * Check the file and directory permissions of your .forward (set in 
      5c above).

      Type...          In order to...
      -------          --------------
      cd               Go to your home directory.
      
      ls -l .forward   Check the permission: it should say -rw-r--r--
      
      ls -ld .         Check permission of home dir: it should say drwx?-x?-x
                       The ?'s may be r's or hyphens or one of each (i.e.,
                       drwx--x--x, drwxr-xr-x, drwxr-x--x, drwx--xr-x).
      

    * If none of these turn up the problem edit your ~/.forward so
      that filter will be verbose with it's output (use the -vo flag).

        "|/usr/local/bin/filter -vo /j/nancym/.elm/filter-errors"

      And repeat steps 6 and 7.  After you get filter to work you 
      will probably want to change the ``-vo'' flag back to ``-o''.

   
8]  After you have successfully tested filter in steps 6 and 7, edit
    ~/.elm/filter-rules so that it contains a modified version of the
    following:

     # if (subject contains "test") then save "/j/nancym/Mail/IN.testing"
     if (to contains "www-talk") then save "/j/nancym/Mail/IN.www-talk"
     if (to contains "hopos-l") then save "/j/nancym/Mail/IN.hopos"

     Replace /j/nancym with your home directory path and
     /Mail with the name of your mail directory.  Replace the mailing 
     list string (e.g., "www-talk") and the name of the mail folder
     (e.g., IN.www-talk) with text for your mailing lists.

     Note that ``to contains...'' means either the To or Cc header contains...

     Rather than deleting the test line, it's useful to just turn it
     into a comment (by preceding it with #) so that you can easily
     use it for future testing.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: Filtering Mail FAQ
Previous Document: 4.0 Filter
Next Document: 4.2 Tracking Your Incoming Mail

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
FAQ Editor <faq-editor@ii.com>





Last Update March 27 2014 @ 02:11 PM