<Full english README.txt here>

Popmail it's my POP3-email-checker-plus-spam-eraser: just a way to browse the contents of your mailboxes and delete emails you don't want to fetch. This program will not fetch the emails (use fetchmail, jfpop or fetchpop to do this), it just applies some rules to the messages IN THE MAILBOX in order to allow you to delete some emails before receiving them (you could, as an example, delete emails with a given From: (sender) header so that forget about some common spammers).

You can also filter emails larger than a specified size, using the maxsize <number> option in your .popmailrc file (or you can disable it by commenting that line or setting it to a big number or -1).

Popmail has an "easy-setup" feature: just run popmail the first time and it will create a config file asking you all what it needs to create it (pop servers, account users, passwords and ports), and then give the file the right permissions. This is the easy-setup method to configure popmail. Just answer some questions and popmail will create all for you.

POPMail can log info about deleted messages on a text file (if you want) so that you can always know what's doing popmail (and see the amount of spammers you ignored :-).

How to use this program

  • Just run the popmail executable. It will open the .popmailrc file in your HOME directory, will parse it (please read the syntax in the example file given in the sources or in /usr/doc/popmail) and will enter and display the info of each pop3 server found in the config file.
  • If you have specified the "maxsize <number>" option in your .popmailrc file, popmail will delete emails larger than <number> bytes. You can disable this feature by commenting the maxsize option, (→ #maxsize 100000) or by setting it's value to a big number (well, surely you don't want to fetch a 100 Mb email, right?, so you can set it to 100000000 :-)
  • If .popmailrc does not exist, when you run popmail it will ask you to create it (by asking you some questions). You can also answer 'n' to popmail's question and create it by yourself. In that case, please read the INSTALL and .popmailrc.example files located in the documentation directory (usually /usr/doc/popmail-version).
  • Specify your filter rules in the filterfile in a similar format to the filterfile.example file. You can this way filter by looking at the message headers.
  • After executing popmail, run fetchmail to retrieve the remaining email. Remember that popmail does not fetch email, it's just an anti-spam filtering program… it allows you to delete emails _BEFORE_ downloading them, so that you _never_ waste time or bandwidth _downloading_ emails you don't want to read.
    Usage:	  popmail [options]
    Options:  --silent           Do not report info to the screen.
              --normal           Report some info to the screen.
              --verbose          Be verbose repporting info.
              --rebuildconfig    Creates a new config file.
              --help             This help.
    Usage:    popmail [options]

How to use and configure POPMail

Just type the following (as root):

    make install

NOTE: If you get complains about "msgfmt" during the compiling process, then you'll need to install gettext to be able to finish the compiling process. Thanks to Antonio Tovar for reporting this issue.

It will copy the popmail executable to /usr/local/bin (you can change that by editing the Makefile and changing DESTBINPATH), and the CHANGES, README, INSTALL, TO_DO and popmailrc.example files to /usr/doc/popmail-version (you can change it by modifying the DESTDOCPATH variable in the Makefile).

After that you should create a .popmailrc file and a .filterfile in your HOME directory, containing the configuration and the filter rules. You can create it by hand or simply running popmail. It will detect that config files do not exist and it will create a config file asking you all what it needs to create it (pop server, account user, password and port), and then give the file the right permissions. This is the easy-setup method to configure popmail. Just answer some questions and popmail will create all for you.

If you prefer creating them by hand, just write something like that on a $HOME/.popmailrc file:

#>------->---------.popmailrc begins-------->------->#

# How many accounts are defined in the file
popservers 2

#--- account number 1 ----------------
server pop.somewhere.com
user theuser
password thepasswd
port 110

#--- account number 2 ----------------
server pop.another.com
user anotheruser
password anotherpass
port 110

# and so on..., note that # are comments (ignored).
# Now we define some setup options for popmail
maxsize 10000000
filterfile /home/youruser/.filterfile
logfile /home/youruser/.popmail.log

#>------->---------.popmailrc ends --------->------->#

When creating this file, please follow the same order as the above example: first of all must be popservers <number>. After that, you can put as <server/user/password/port> blocks as defined in <popservers>. Follow too the same order (first server, then user, then password and last port). Finally you can put popmail's extra options such the maxsize or the filterfile.

Give it the right permissions (chmod 0600 .popmailrc), and run popmail. It will parse the config file and it will browse all the pop3 servers specified, deleting all the SPAM/Trash messages (according to the filters that you insert in the config file). Remember that you can disable any of the extra options (maxsize and filter file) just by putting a '#' at the start of the line. The maxsize option specifies the maximum size an email can have to be downloaded (popmail will erase emails bigger than maxsize, so I set it to 10000000 because I don't want to receive big emails).

The filter file is just a text file which will contain the rules for the messages that must be deleted. Use '#' to write comment lines, and use the following template:

#>------->-------- yourfilterfile starts ----->------->#

# This is my filter file. I filter some common spammers.
deny ^From:.*spammer@spammer.com
deny ^From:.*@spammerserver.com
deny ^From:.*spammer_changing_servers@
deny ^Subject:.*WIN MONEY
deny ^Subject:.*FOR FREE
deny ^Subject:.*FREE.*SEX

#>------->-------- yourfilterfile ends-------->------->#

This way if you are receiving spam from a given email address, or from a given domain, or tipical messages ("free sex, earn money, and so on") you can delete it by putting a filter in this file. Remember that THE MESSAGE IS DELETED ON THE SERVER, you don't need to get it to delete them. This means that you will not download the message, saving time and money. Note that POPMail does not retrieve email, it just deletes those which you don't want to receive. Call fetchmail or similar (netscape, mutt, balsa, kmail, jfpop, animail…) after executing popmail in order to retrieve the _remaining_ (no spam) messages.

The logfile will be created by POPMail with info about each deteled message (in order you can ask the Sender or just know who is sending you spam). It looks like:

POPMail - Account: mailuser on pop.mail.com at Wed Jun 14 16:02:48 2000
 > Msg 13 deleted [2264 b]. Deny ^From:.*SenderEmail@somewhere.com
 > From: SenderEmail@somewhere.com
 > Subject: Buy my new computer stuff!!!

POPMail - Account: mailuser on pop.mail.com at Thu Jan 14 16:02:49 2000
 > Msg 2 deleted: 1217600 bytes > MAXSIZE (100000).
 > From: TheEmail@bigmessages.org
 > Subject: Get this mpeg video... about 10 minutes downloading...

(and so on).

You can delete this file whenever you want. I suggest using logs so that you know what's doing popmail. If you lose a message by a bad filter you put on .filterfile, you can use this file to determine the failing filter, and ask the Sender to re-send you the message.


You can download the latest version of POPMail in source code (tar.gz) or RPM format (binary, source) on those links:

Version 2.1.1 can be still downloaded locally. There is also a 2.1.1-1 patch available.

Thanks to

  • Steven Radack (steve@lconn.net), author of mailcheck v0.1 .
  • Juanjo Alvarez (*puntero_loco) and Ferkys.
  • Jim Frost (jimf@world.std.com), for his "BSD Sockets" tutorial.
  • Esteban Navarro (aka ScanDisk) for the beta-testing :).
  • Stefan Baehre, author of PopSneaker.
  • Lord Iñaki Arenaza and J. A. Gutierrez for all the help given since I started programming under Linux. Surely this program (and others I've coded) would not exist without their help.
  • SimManiac, for 1.x and 2.x versions.

<Volver a la sección de Programas>