GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: pop3d   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index

3.16.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 configuration statement:

expire n;

Enable automatic expiration of messages after n days.

The 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 configuration statement:
    delete-expired bool;

    If bool is ‘true’, delete expired messages after receiving the QUIT command.

  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 configuration keyword.

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

GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: pop3d   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index