CleanPOP - Keep your POP3 mailbox clean Logo

Download the current release


cleanpop [-D directory] [-f configfile] [-l logfile] [-d datafile] [-m mboxfile]


cleanpop logs into your POP3 server and deletes messages which have had a local (or remote) spam header added to them, as well as messages that have been on the server for longer than a user-configurable amount of time. cleanpop helps you keep your POP3 mailbox clean, so you can use webmail or download messages from your POP3 server to other machines without having to deal with spam. cleanpop also prevents your POP3 mailbox from filling up by purging old messages.

cleanpop never deletes an unfetched message because it correlates messages from your local mbox file with messages on the POP3 server. cleanpop is fast because it keeps a local cache of the server's UIDL message info; it only reads the headers of unseen emails from the POP server.


-D <directory>
Set working directory for relative paths.

-f <configuration file>
Location of configuration file.

-l <log file>
Location of log file; output is sent to stderr otherwise.

-d <data file>
Location of cached UIDL data file.

-m <mbox file>
Location of user mbox file. /var/mail/username is the default.

cleanpop can be run from the user's crontab. The following entry launches cleanpop every 15 minutes, and writes output to a logfile in the user's home directory.

    0,15,30,45 * * * *    cleanpop -l cleanpop.log


The file format is similar to other Unix configuration files. Comments begin with a character and extend to the end of the line. Blank lines are ignored. Configuration commands consist of a keyword, followed by an equal sign, and then a value. A sample configuration might look as follows:

    server =
    user = waldo
    pass = 1234
    expires = 2 months
    spamheader = ^(?-i:X-CRM114-Status: SPAM|X-CRM114-Action:)
server (required)
Host name or IP address of the POP3 server.

port (optional)
Port on which POP3 server is running.

user (required)
User name on POP3 server.

pass (required)
User password on POP3 server.

expires (optional)
Maximum time any locally fetched message should stay on the server. Can specify hours, days, weeks, or months (a month is considered 30 days). If the time units are unspecified, the default is days.

spamheader (optional)
Perl regex that matches spam headers in your local mbox file.


default configuration file

default cache data file


Copyright 2003 Gary Gurevich.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Gary Gurevich <>