SpamCorral Documentation

3. Spam Remailer

3.1 Description

As we said in the Spam Notifier Descripton Section, the SpamCorral notification program ( can be run periodically by a cron job, whereupon it will send email notification messages to all of the recipients of spam. When a user receives the notification, they can optionally reply to the message (using their mailer's reply function), retaining the description of any pieces of spam which they wish to see and deleting the description of those which they don't. The action is simple and natural, in that it is just like replying to any other piece of email that they receive.

A second program in this package, the spam handling robot, listens for messages sent to it, as replies to notification messages, requesting that spam be extracted from the mail corral and remailed to the original recipient. Upon verification of the sender's right to remail the spam, the corralled messages will be remailed to them but, this time, they will pass directly through the sendmail filter unscathed. The operation of the spam handlers is automatic and unattended, simply responding to requests from the recipients to remail all of the spam that they ask to see. No intervention by administrative personnel is required. Furthermore, no important or interesting messages are ever dropped by accident. The recipient has final say in all decisions.

3.2 How it Works

Normally, is invoked by sendmail by placing the command in the ".forward" file for the spam handling robot. For example, if the spam handling robot userid is "spamrobot" and their home directory is "/home/spamrobot", the ".forward" file should be "/home/spamrobot/.forward" and it should contain the following:


Note that one of the "features" of sendmail is that it uses a special shell program called "smrsh" to invoke all executables in the ".forward" file. This shell is very restrictive in what it can execute. Specifically, you must put a soft link to this program in the directory that specifies the acceptable programs for "smrsh". This directory is probably either "/etc/smrsh" or "/usr/adm/sm.bin" (see the code in smrsh.c). You should also check your config file to see if this "feature" is enabled and possibly what the name of the "acceptable" directory is. For more information, look at "man smrsh".

You might want to write output from this program to a log file, in which case, you should define the variable $LOG_FILE. If it is defined, the log will go to the file specified. Don't forget to add this file to logrotate so that it won't grow to be too ginormous.

The body of the email message contains one or more lines that have the names of spam message files that are to be remailed to their original user. The rest of the message body is ignored.

For each spam message file name that is found in the body of the message being processed by this program, the corresponding spam message will be remailed to its original destination and then purged. That's about it. Pretty simple.