PHP Classes

Prune Mailboxes

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  Prune Mailboxes  >  (Un) Subscribe thread alerts  
Subject:Prune Mailboxes
Summary:I want to prune mailboxes of all emails of 1 month or older?
Messages:2
Author:Andrew Wright
Date:2008-02-22 14:05:15
Update:2008-02-22 19:07:15
 

  1. Prune Mailboxes   Reply   Report abuse  
Picture of Andrew Wright Andrew Wright - 2008-02-22 14:05:16
Hi,

I want to write a script to delete all messages from a mailbox / mailboxes which are more than 1 month old. I have install the pop3class (which seems awesome) on my server and it has access to the mailboxes (all are pop3).

I know that I would have to iterate through all the emails on the server and test to see how old they are, then use the delete command to delete but I am struggling to understand the documentation AND I am a bit of a newbie to classes...

Any help would be much appreciated (especially pseudo-code :o) )

  2. Re: Prune Mailboxes   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-02-22 19:07:15 - In reply to message 1 from Andrew Wright
You just need to open the mailbox, iterate over each message retrieving the headers only with the RetrieveMessage function. Then you need to find the Date header to make the necessary comparisons in order to determine if you need to delete the message or not.