NAME

popclean - script to purge messages at a POP3 server older than a certain age, larger than a given size or tagged by a spamfilter.


SYNOPSIS

popclean [options]

Options:

 -a, --maxage                      Set maximum age in hours before a message is purged
 -l, --limit                       Messages larger than this limit in KB will be deleted
 -g, --spamtag                     Messages with this text in the subject will be considered tagged as spam and will be deleted
 -f, --fetchmailrc=file            Specify an alternate name for the fetchmail run control file
 -i, --uidlfile=file               Specify an alternate name for the .fetchids file
 -k, --skipuidl                    Bypass verification of .fetchids file
 -u, --user                        Specify username
 -p, --password                    Specify password
 -s, --server                      Specify POP3 server name or IP address
 -t, --test-mode, --test           Operate as normal but do not actually purge messages
 -S, --syslog                      Write messages to syslog daemon
 -T, --timeout                     Set timeout in seconds for connecting to the POP server
 --attempts                        Number of attempts before giving up on connecting to a server
 -P, --port                        The POP server port number
 -v, --verbose                     Write details about deleted messages
 -d, --debug                       Write detailed information while processing messages
 -F, --force                       Purge messages even with unrecognisable date
 -V, --version                     Print version
 -?, --usage                       Print usage message
 -h, --help                        Print documentation


OPTIONS

-A, --maxage N
Any message older than N hours will be deleted. If --maxage=0 is specified the age will be ignored. This is useful when deletion based upon size is intended. Default: 48

-l, --limit N
Any message larger than N Kbytes will be deleted. If limit=0 is specified the size will be ignored. This is the default behaviour. If --limit and --maxage are combined they are OR'ed. This means a message needs to exceed either --limit or --maxage to be deleted. Default: 0.

-g, --spamtag <tag>
Specifies a string that, if present in the subject line, causes the message to be deleted from the server. Spamfilters often add a special tag to the subject of a message to indicate it is considered spam. If --spamtag and --maxage are combined they are OR'ed. This means a message needs to exceed either --maxage or be considered spam to be deleted. Default: 0.

-V, --version
Displays the version information for your copy of popclean. No further actions are performed.

-u, --user <username>
The -u parameter will cause popclean to process a specific user account. This requires the server name or address to be specified as well.

-s, --server <servername or address>
Specifies the host name or dotted IP address of the POP3 server. This option is required if -u is given.

-p, --password <password>
Specifies the cleartext password belonging to the user account as specified by -u and -s. If no password is specified but the -u and -s options are present, the user is prompted to specify one.

-P, --port <portnum>
Specifies the POP server port (default = 110). This value overrides the value specified in the fetchmailrc file.

-T, --timeout <seconds>
The timeout option (default = 60 seconds) allows you to set a server-nonresponse timeout in seconds. After the timeout expires the connection is considered dead. This value overrides the value specified in the fetchmailrc file.

--attempts <number>
Number of attempts (default=3) to connect to a server. Sometimes the first attempt to connect to a server fails for unknown reasons, usually network related. This option allows the control of the number of retries. Authorization failures are never retried.

-f, --fetchmailrc <filename>
Specify the location of the fetchmail configuration file> By default popclean will look for the file $HOME/.fetchmailrc. Many options and directives are ignored. The following options are actually used: server, username, password, port, timeout. When account information is explicitly specified through the --user option this file is ignored. See the README file for details.

-i, --uidlfile <filename>
Specify an alternate name for the .fetchids file used by fetchmail to save POP3 UIDs. By default the file $HOME/.fetchids is read to validate POP3 UIDs to make shure that fetchmail has fetched a message before deciding to delete it. This prevents deletion of messages when fetchmail has not run for a period longer than MAXAGE. This value overrides the value specified in the fetchmailrc file.

-k, --skipuidl
Bypass validation of UIDs against the .fetchids file. Beware of the danger of unwanted deletion if fetchmail has not run in a while. This option is useful if fetchmail is not around (in this case also use --user, --password and --server) or is not using the UIDL option for some reason.

-t, --test-mode, --test
Popclean will work normally but will not actually delete any messages. This is especially useful for testing purposes.

-S, --syslog
This option allows you to redirect status and error messages emitted to the syslog(3) system daemon if available. Messages are logged with an id of popclean, the facility LOG_MAIL, and priorities LOG_ERR, LOG_ALERT or LOG_INFO. This option is intended for logging status and error messages which indicate the results while cleaning a POP account. Error messages for command line options and parsing the configuration file are still written to stderr.

-v, --verbose
Verbose mode. Information about processed messages is echoed to the output.

-d, --debug
Debug mode. Implies verbose mode. Echoes extra diagnostic information about all messages. In particular the conversation with the POP3 server echoed. Warning: This can cause lots of output when many messages and/or many accounts are processed.

-F, --force
Forced deletion of messages. Sometimes the age of a message cannot be determined due to malformed date headers. With this option these messages are always deleted. Beware: this can lead to deletion of recent messages.


DESCRIPTION

Fetchmail downloads (``fetches'') messages from a POP3 mailserver and forwards them your local (client) machine's delivery system using SMTP. It can either leave a copy of these messages on that server or delete them entirely. Many users of fetchmail have requested the possibility to postpone that deletion to a later date. Every single user has different reasons for that request. As per the FAQ (see http://catb.org/~esr/fetchmail/fetchmail-FAQ.html), item G5, fetchmail is not meant to implement policy; hence the second-most-requested feature for fetchmail is denied. Popclean comes to the rescue.

Popclean is a perl script that deletes messages from a POP3 server a certain amount of time after they have been received by that server. It does so by looking at the latest ``Received:'' header. It was designed to work in conjunction with fetchmail. By default, account information is obtained from the fetchmail configuration. Popclean will also look at the .fetchids file to determine if a message was received by the local host before deleting it from the POP server. This helps in avoiding deletion of unread messages.

Additionally, popclean can delete messages that exceed a certain size or contain a tag in the subject line that was inserted by a spamfilter.

Provided the correct set of arguments was specified no Fetchmail information is needed. Many options control the behaviour of popclean. Some of them actually make the presence of fetchmail optional.


ENVIRONMENT

No environment variables, aside from those used by perl, are required to be set.


SEE ALSO

fetchmail(1)


AUTHOR

Jan Klaverstijn <jan@klaverstijn.nl>


PREREQUISITES

Mail::POP3Client
Mail::Header
HTTP::Date
Sys::Syslog