Next: , Previous: Login delay, Up: pop3d


2.13.2 Auto-expire

Automatic expiration of messages allows you to limit the period of time users are permitted to keep their messages on the server. It is enabled by --expire command line option:

     $ pop3d --expire=days

Here, days specifies the minimum server retention period, in days, for retrieved messages on the server.

Current implementation works as follows. When a message is downloaded by RETR or TOP command, it is marked with ‘X-Expire-Timestamp: n’ header, where n is current value of UNIX timestamp. The exact expiration mechanism depends on you. Mailutils allows you two options:

  1. Expired messages are deleted by pop3d upon closing the mailbox. You specify this mechanism using --delete-expired command line option.
  2. Expired messages remain in the mailbox after closing it. The system administrator is supposed to run a cron job that purges the mailboxes. Such a cron job can be easily implemented using sieve from GNU Mailutils and the following script:
              require "timestamp";
              # Replace "5" with the desired expiration period
              if timestamp :before "X-Expire-Timestamp" "now - 5 days"
                {
                  discard;
                }
    

    This script will remove expired messages 5 days after the retrieval. Replace ‘5’ with the desired expiration period and make sure it equals the argument to --expire command.

The option --expire=0 means the client is not permitted to leave mail on the server. It always implies --delete-expired.