Search The ForumSearch   RegisterRegister  LoginLogin

MailBee POP3

 AfterLogic Forum : MailBee POP3
Subject Topic: Delete messages Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Guests
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 02 September 2004 at 7:09am | IP Logged Quote Guests

Is it possible to delete messages with mailBee pop3, and if not, how can a message be uniquely identified?
Back to Top View Guests's Profile Search for other posts by Guests
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 02 September 2004 at 7:28am | IP Logged Quote Alex

MailBee POP3 object allows both deleting and unique identification of messages.

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 View Alex's Profile Search for other posts by Alex
 
Guests
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 02 September 2004 at 7:36am | IP Logged Quote Guests

Thanks for the prompt reply! Couldn't find that method in the documentation...
Back to Top View Guests's Profile Search for other posts by Guests
 
Guests
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 13 October 2004 at 9:38am | IP Logged Quote Guests

What would I use to delete the ALL the emails in the inbox? Thanks!
Back to Top View Guests's Profile Search for other posts by Guests
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 13 October 2004 at 9:47am | IP Logged Quote Alex

To delete all messages, just use the loop like below:
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 View Alex's Profile Search for other posts by Alex
 
Guests
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 13 October 2004 at 11:12am | IP Logged Quote Guests

Only nine minutes for a response. I'm sold! Thank you Alex.
Back to Top View Guests's Profile Search for other posts by Guests
 
Guests
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 22 February 2005 at 2:08pm | IP Logged Quote Guests

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.

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 View Guests's Profile Search for other posts by Guests
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 22 February 2005 at 2:51pm | IP Logged Quote Alex

Yes, new messages are always added to the end of mailbox, and their message number values will be greater than existing messages' ones.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide