Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Remove old emails from POP servers Network
I use the mail application provided with MacOSX to get my emails. This is a great application. But I like to keep my emails on the POP server for a couple of weeks, in case I want to get them on another machine. And the Mail application doesn't provide a way to clean the old emails that are still on the server.

Therefore I wrote a little perl script called "nettoie_mail.pl" that does it for me. You can get it here. You can lauch that script from anywhere, but the recommended way is to copy it to /usr/local/bin (with the terminal). As this script should be lauched on a regular basis, it should be included in the /etc/crontab file or in the /etc/daily.local file. For example, my choice is crontab:
5  2,13  *  *  *  root /usr/local/bin/nettoie_mail.pl
Hope this helps.

[Editor's note: I haven't tried this script myself, but I looked at the source and it doesn't appear there's anything malicious going on.]
    •    
  • Currently 1.67 / 5
  You rated: 3 / 5 (3 votes cast)
 
[2,958 views]  

Remove old emails from POP servers | 1 comments | Create New Account
Click here to return to the 'Remove old emails from POP servers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
You'll need the Mail::POP3Client module
Authored by: wal9000 on Mar 18, '02 07:22:48AM

This script works great! I'd been planning on writing something similar in Java or Perl but never got around to it... a big thank you to the author!

Note that the script uses the Mail::POP3Client module, which you can download from CPAN.org.

This hint forgets to mention that you have to open and edit the Perl script and enter your email server information: your login name, your email password, and the address of your POP mail server. There's also a place where you can enter in the age, in days, of messages to be deleted, but the script is actually hardcoded to deleting email that's 20 days or more old. To fix this, go to line 42 and change it from

if ( ($t0-$date) > 20*86400 ) {

to

if ( ($t0-$date) > $toold*86400 ) {

Handy little script.



[ Reply to This | # ]