| Author | 
         | 
         
      
        
         
         Naresh Newbie 
          
 
  Joined: 12 April 2007 Location: India
 Online Status: Offline Posts: 9
          | 
        
         
          
           | Posted: 08 August 2007 at 1:21am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
Hi,
 
 We need to provision our system to automatically purge messages older then X days. Please let us know how this could be done programmatically interfacing with the server.
 
 Regards,
 Naresh
 
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   | 
      
        
         
         Andrew AfterLogic Support 
          
 
  Joined: 28 April 2006 Location: United States
 Online Status: Offline Posts: 1189
          | 
        
         
          
           | Posted: 08 August 2007 at 1:57am | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
You should connect to the IMAP server, then use Imap.Search  method with BEFORE <date> condition to get UIDs of all messages which older than specified date. Then, use Imap.DeleteMessages method to delete all messages which correspond the found UIDs.
 
 Please don't forget to call Imap.Expunge method to permanently delete messages which were marked as deleted during the operations described above.
 
 
 Best regards,
 Andrew
         | 
       
       
        | Back to Top | 
         
          
         | 
       
       
       
        |   |