Home | Contact  

Install and run spam.pl

Do note that this concerns spam.pl v0.19 and later.


Copy the spam.pl file into a suitable directory. Preferably one that already is in your path. Make sure it has the executable flag set.

Edit the script to make sure the #!-path (the first line of the script) to the perl path your system uses.

Important: if you intend to use any whois-service, figure out how your whois works and change the whois line accordingly. You might need to write it similar to "whois -h whois.abuse.net $badhost" instead of the existing version!

As of v0.24 whois lookups are used through modules.

Required Modules

These modules are all standard cpan.org modules.


Necessary Personal Config Stuff

Copy the config file from the release archive into your ~/.spam/ directory and edit it according to your preferences. One of the most important is the '$mailcmd' that should be set to the full path to your system's sendmail. If you already have a config file there, just get the good stuff from the one you just got so that you don't overwrite your old personalised one.

You really should make a file called ~/.spam/friends that should contain a newline separated list of friendly domains. Friendly domains are domains that are involved in relaying normal mails to youm who you would not like to send complaints to.

The ~/.spam/friends file could look like:


You do want to set your proper email address in the file ~/.spam/from. It should be nothing but the email address that you want to appear in all the complaint mails this script will send.

The ~/.spam/from file could look like:


To make your complaints personal, and to be able to fully stand for each outgoing mail that spam.pl sends away, I recommend that you edit your own complaint message to reflect your own views on spam. The ~/.spam/complaint file should be a plaint ASCII file not wider than say 78 columns and it will be included first in every spam complaint sent away.

The ~/.spam/complaint file could look like:

Dear Sirs,

I received the following not so very amusing mail and you seem to be
running one the mail servers that relayed it through to me.

Please correct this mistake.

Please make sure that your complaint message is accurate and polite. You won't reach any better results by being rude, and the mail may in fact reach some poor innocent mail administrator in cases where headers are cleverly forged.

Run it

I always run spam.pl from inside my mail program (pine). I then switch on displaying all headers and then I enter the command to pipe the mail into an external program and enter 'spam.pl'. Of course I must make sure that the script is in my path first.

Command Line Options

There are a few options you can use to modify spam.pl's behaviour:

Use -a to send all complaints through the service of abuse.net. You must be registered with them before you use this.

Use -b to make spam.pl attempt to extract host names from "web links" mentioned in the mail body.

Use -d to run it in "debug mode". This will make spam.pl to just show what hosts it can extract, without sending any actual mail. Very useful for trying out that your friends list works ok etc.

Use -e to tell spam.pl to invoke your $EDITOR on the receiver list before the mail is actually sent.

Use -m to bcc the mail to yourself at the same time as the offenders.

Use -w to make the script use the whois.abuse.net service, that checks for better complaint receivers for offending domains.

Add a plain email address on the command line to make the mail get sent to that receiver only.