Filtering Out Spam at the Mailer:
Despite your best efforts, spam and other unwanted mail will get to your users. This is partly because you can't block all of the spam, and partly because not all unwanted e-mail is spam. Sometimes, a user just doesn't want to look at some legitimate e-mail simply because of personal preference. In this case, the mail needs to be filtered at the user's mail reader. Most mail readers provide this capability. This section provides a few examples.
Using the elm Filter
elm is an old terminal mode mailer. elm has some die-hard fans, but most users have moved on to mailers that include a graphical user interface. However, the elm source code distribution comes with a filtering tool aptly named filter. The source code is available from ftp.virginia.edu, where it is stored in the /pub/elm directory. Even if you don't use elm, you can use the filter program to process incoming mail.
The filter program is invoked with the .forward file (covered during the discussion of sendmail aliases). Its primary purpose is to provide each user with a way to specify personal mail forwarding. One feature of .forward is that it can forward mail to a program, which is the feature used to send mail to the filter program.