Author |
|
Guests Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 02 September 2004 at 7:09am | IP Logged
|
|
|
Is it possible to delete messages with mailBee pop3, and if not, how can a message be uniquely identified?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 02 September 2004 at 7:28am | IP Logged
|
|
|
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 |
|
|
Guests Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 02 September 2004 at 7:36am | IP Logged
|
|
|
Thanks for the prompt reply! Couldn't find that method in the documentation...
|
Back to Top |
|
|
Guests Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 13 October 2004 at 9:38am | IP Logged
|
|
|
What would I use to delete the ALL the emails in the inbox? Thanks!
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 13 October 2004 at 9:47am | IP Logged
|
|
|
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 |
|
|
Guests Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 13 October 2004 at 11:12am | IP Logged
|
|
|
Only nine minutes for a response. I'm sold! Thank you Alex.
|
Back to Top |
|
|
Guests Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 22 February 2005 at 2:08pm | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 22 February 2005 at 2:51pm | IP Logged
|
|
|
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 |
|
|