sortmail -- download and classify email Code
Brought to you by:
efalk
@(#)README 1.5 02/03/11 falk $Id: README,v 1.1.1.1 2002/03/12 05:38:57 efalk Exp $ To build sortmail: o edit Makefile for your system. Sortmail has been built and tested under SunOS 4.1, Solaris 5.7 and GNU Linux; these settings should work for most BSD and SVr4 systems, respectively. o edit config.h and change any system-dependent defaults that might need changing. The current defaults are probably correct for most systems. o type "make" Simplified directions for installing sortmail: o Move sortmail to any convenient location. If you have a directory you normally keep your personal programs in, this is the ideal place to put sortmail. You can even leave it where you built it. o Next, create a .sortmailrc file in your home directory. This is the file that tells sortmail how you want your incoming mail handled. The file sample.sortmailrc can be used as an example. See the sortmail.1 man page for a full description. o Create a directory to store mail folders (you may have already done this). For example, if your folder directory is called "Mail", then edit your .mailrc file (create if neccessary) and add a line that looks like set folder=Mail This command can go either in your .mailrc or .sortmailrc files. In the former case, many Unix mailers will make use of it as well. o Finally, if you receive email on your local machine, create a .forward file in your home directory. This file redirects your mail through sortmail. See sample.forward o If you use POP to retrieve email from a remote server, then use the "-pop user@host" commandline option to sortmail. This is all it takes. Don't forget to read these folders once in a while. You can read a mail folder by typing e.g. "mail -f +scuba" if you use regular mail. If you use Sun's mailtool, enter "scuba" in the "Mail File:" field and hit the "Load" button. (With mailtool, I find that it makes life easier to have this line in my .mailrc file: set filemenu="+scuba +other +bounces" (Now, if I use the menu button on my mouse over the "File:" field in mailtool, these folders will be in the menu. Developer's Notes on Locking: In any mailer system, it is a good idea to lock any mailbox before making changes to it. This prevents two programs from simultaneously trying to make changes, which usually results in chaos. For an example, execute these commands: touch $HOME/Mail/other Mail -s test1 +other < /etc/termcap & Mail -s test2 +other < /etc/termcap The first command creates an empty mailbox in your folder directory. The second command *simultaneously* sends two messages to that mailbox. If you now examine $HOME/Mail/other, you will discover that the two messages are jumbled together. This is an example of what happens when mailboxes are not properly locked. There are three different ways to lock files under Unix: the fcntl() system call, the flock() system call, and via the use of lock files. The file config.h is used to select the the locking method used on your system. If your system is not listed in config.h, you will need to experiment and/or read source code of other mailers to determine which method is correct. Please send me your results so I can add them to sortmail. See locking.c for a full treatment of this problem.