DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Using e-mail

Redirecting incoming messages to other folders

Redirecting mail to folders other than your system mailbox is useful for keeping all the mail on a particular subject or the messages sent to an alias to which you belong in one folder.

To deliver mail to different folders, you must first set up the file .maildelivery in your home directory. To do this:

  1. Create the .maildelivery file in your home directory:

    cd
    touch .maildelivery

  2. Set the access permissions to 644 (-rw-r--r--):

    chmod 644 .maildelivery

  3. Create a directory in which to put all the redirected mail. For example, create a directory called myfolders in your home directory:

    mkdir myfolders


    NOTE: If you do not create the directory in which to redirect your mail before setting up .maildelivery, you can create an infinite loop because mail cannot be delivered to a nonexistent directory.

  4. Lines in .maildelivery take the form of this example:

    #Header Content Action Result Filename
    to login > ? /usr/spool/mail/login

    The line beginning with the number sign ``#'' is a comment. Replace login with your login name.

    The ``>'' character in the ``Action'' column causes these messages to be added to (/usr/spool/mail/login). The ``?'' in the ``Result'' column means that the message will be considered to have been delivered if it arrives safely in the system mailbox. If the message has already been delivered, the message will not be added to the mailbox. This is important if you do not want a message delivered to more than one folder.

    To redirect messages with specific patterns in the ``Subject'' header, specify subject in the ``Header'' column and the pattern to be matched in the ``Content'' column. For example, to redirect mail on the subject of ``Style'' to myfolders/style.mail, add the following line to .maildelivery:

    subject "Style" > A /u/login/myfolders/style.mail

  5. Redirect mail addressed to any alias to which you belong. For example, if you want all messages sent to the engr alias to go to a folder called myfolders/engr.mail, add the following lines to .maildelivery:

    to engr > A /u/login/myfolders/engr.mail
    cc engr > A /u/login/myfolders/engr.mail

    The ``A'' in the ``Result'' column means that a message that has already been delivered will still be added to the folder.

    The engr.mail folder is created when it first receives mail; you do not need to create it yourself.

  6. Add a line to deliver all the messages that are not caught by the conditions you have specified. Add the following lines to .maildelivery:

    default - > A /usr/spool/mail/login
    #

    The ``default'' in the ``Header'' column matches this field if the message has not already been delivered. The dash character (-) indicates that the ``Content'' field is not used here.

For more information on the format of the .maildelivery file, see the maildelivery(F) manual page.


Next topic: Sending automatic responses when on vacation
Previous topic: Automatic notification of new mail

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003