Search The ForumSearch   RegisterRegister  LoginLogin

MailBee POP3

 AfterLogic Forum : MailBee POP3
Subject Topic: Deleting a specific email Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Hippieboy
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 09 January 2004 at 12:26pm | IP Logged Quote Hippieboy

I am retreiving all the messages and by using a for loop i am cycling through all the emails. I am trying to have it delete a message when the subject line contains certain text. So in ASP i wrote this
Set objMsg = objPOP3.RetrieveMessages
     For Each Msg In objMsg
       if instr(Msg.Subject,"delete me")>0 then Msg.DeleteMessage
     Next
   

but i get an error that the object doesnt support this.
What am i doing wrong?
Back to Top View Hippieboy's Profile Search for other posts by Hippieboy
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 09 January 2004 at 1:30pm | IP Logged Quote Alex

DeleteMessage is a method of POP3 object. The code should be as follows:

Set objMsgs = objPOP3.RetrieveMessages
For I = 1 To objMsgs.Count
Set objMsg = objMsgs(I)
If InStr(objMsg.Subject, "delete me") > 0 Then
    objPOP3.DeleteMessage I
End If
Next

BTW, if you do not need message body (i.e. if all procesing is about analyzing headers such as Subject), you may use RetrieveHeaders instead. This will work much faster.

Also, it's recommended to check objMsgs for Nothing before use. POP3 object returns Nothing if connection is lost during messages download.

Set objMsgs = objPOP3.RetrieveMessages
If objMsgs Is Nothing Then
' Error!
Else
' All's fine
End If

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