| Author |  | 
      
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          Is it possible to delete messages with mailBee pop3, and if not, how can a message be uniquely identified?
           | Posted: 02 September 2004 at 7:09am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          MailBee POP3 object allows both deleting and unique identification of messages.
           | Posted: 02 September 2004 at 7:28am | IP Logged |   |  
           | 
 |  
 To delete a message, you can use POP3.DeleteMessage method (the sample below deletes first message from the mailbox):
 
 
| Code: 
 
    
    | 
      
       | Set objPOP3 = CreateObject("MailBee.POP3")
 objPOP3.LicenseKey = "Your MailBee key"
 If objPOP3.Connect("mail.server.com", 110, "user", "pass") Then
 objPOP3.DeleteMessage 1
 objPOP3.Disconnect
 End If
 
 |  |  |  
 To uniquely identify messages, you can use POP3.Search method to get array of Unique-ID's of all messages in the mailbox, or POP3.GetMessageUID/POP3.GetMessageNumberFromUID methods to get individual Unique-ID value for specified message number and vice versa.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          Thanks for the prompt reply!  Couldn't find that method in the documentation...
           | Posted: 02 September 2004 at 7:36am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          What would I use to delete the ALL the emails in the inbox? Thanks!
           | Posted: 13 October 2004 at 9:38am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          To delete all messages, just use the loop like below:
           | Posted: 13 October 2004 at 9:47am | IP Logged |   |  
           | 
 |  
 
| Code: 
 
    
    | 
      
       | Set objPOP3 = CreateObject("MailBee.POP3")
 objPOP3.LicenseKey = "Your MailBee key"
 If objPOP3.Connect("mail.server.com", 110, "user", "pass") Then
 For I = 1 To objPOP3.MessageCount Then
 objPOP3.DeleteMessage I
 Next
 objPOP3.Disconnect
 End If
 
 |  |  |  
 POP3 protocol does not support "delete all messages" within single command, so using the loop is the only way to delete multiple messages.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          Only nine minutes for a response. I'm sold! Thank you Alex.
           | Posted: 13 October 2004 at 11:12am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          Following the code example above to delete all messages. Is it guaranteed that if after connecting and then reconnecting to delete all messages, any new messages that have arrived in the mean time will be at the next index up.
           | Posted: 22 February 2005 at 2:08pm | IP Logged |   |  
           | 
 |  
 i.e. change delete messages code above to delete up to known message count not current message count as a new message could have arrived.
 
 Andy
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Yes, new messages are always added to the end of mailbox, and their message number values will be greater than existing messages' ones.
           | Posted: 22 February 2005 at 2:51pm | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  |