*******************  DELETE - LATER ********************

    tool for deleting email messages on POP3 accounts
    after a given period of time (in days)

    e.g. if you want to keep the messages 30 days to 
    have webmail access while on the road

********************************************************

  the script queries the current contents of a POP3 mailbox, 
  stores the message IDs of that run and saves them to a MySQL database

  on each run it compares the date on which the message was first seen with 
  the current date and deletes the message, if that difference is greater than
  the value of the column "retaindays"

  the script stores account settings in a separate MySQL table for easy maintenance
  each email account needs an unique ID

  the script scales well on large installations with several thousands of messages 
  a day if you run it at a time of low email volume (e.g. at 4 am)



REQUIREMENTS
------------
- MySQL database server and client software (v3.23 or later, www.mysql.com)
  MySQL sources (for compiling mysqltcl only)
- mysqltcl script (www.xdobry.de/mysqltcl/)
- libexpect (v5 or later)



INSTALLATION
------------
1. create the tables "fetchmail" and "fetchmail_users" on a MySQL server by running
   CREATE TABLE `fetchmail` ( `UserID` BIGINT UNSIGNED NOT NULL DEFAULT 0, `UID` VARCHAR(255) NOT NULL DEFAULT '',  `Fetchdate` DATE NOT NULL DEFAULT 0,  PRIMARY KEY(`UserID`, `UID`)) ENGINE = MYISAM;
   CREATE TABLE `fetchmail_user` ( `UserID` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `server` VARCHAR(255) NOT NULL DEFAULT '', `username` VARCHAR(63) NOT NULL DEFAULT '', `password` VARCHAR(63) NOT NULL DEFAULT '',  `retaindays` INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY(`UserID`)) ENGINE = MYISAM;

2. Fill the table "fetchmail_users" with the settings of the email accounts you wish to check

3. copy the script "delete-later" to a safe place, make it executable and edit the first lines to match your MySQL setup

4. run "delete-later" via cron AFTER you fetched your emails with settings that keep the messages on the server (e.g. via fetchmal --keep)



COPYRIGHT
------------
Copyright (c) 2007 Yoo GmbH, Zellwaldring 51, D-09603 Grossvoigtsberg, Germany 

Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that the content of this README file appears in all copies 
of the software and related documentation.



NOTES
------------
The age of an email message is calculated by the difference in days between 
the run of "delete-later" it was first seen on and the current date, not the 
actual date the message was sent. So if you run the script every week, the period 
after which a message is delete may vary up to 14 days.
This is due to the common practice of spammers to change the message date 
to some date in the far future to get the message first place in your inbox.



DISCLAIMER
------------
THE SCRIPT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. 

WE (YOO) HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD 
TO THIS README AND SCRIPT, INCLUDING ALL WARRANTIES AND CONDITIONS 
OF MERCHANTABILITY, WHETHER EXPRESS, IMPLIED OR STATUTORY, 
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. 

IN NO EVENT SHALL YOO AND/OR ITS REPRESENTATIVES AND/OR RESPECTIVE 
SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES 
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS README 
OR SCRIPT.



CONTACT
------------
For help, bug reports or other request regarding "delete-later" please
contact Carsten Ralle (English/German) by writing an e-mail to 

                   cr <at> i4yoo <dot> de 

with a subject starting with "DELETE-LATER: "

Please note, that messages containing HTML or images will be automatically deleted.


------------------------------------------------------------------------------------
Yoo GmbH, Zellwaldring 51, D-09603 Grossvoigtsberg, Germany 
                                                                      www.yoogmbh.de
------------------------------------------------------------------------------------
