Last time I tried using CFPOP to delete messages it drove me crazy. If I
recall correctly, you can't really loop and delete message 1, then 2, then
3, etc. When you delete message 1, message 2 becomes number 1, 3 becomes 2,
4 becomes 3, etc. So when you go to delete message number 2, you're really
deleting what was originally the 3rd message. Say you have exactly 8
messages in the mailbox and step through them, deleting each one. When you
go to delete number 5, there isn't one.
If that made no sense, then maybe I could explain it differently. The
message numbers when you do deletes have no real relationship to the message
numbers when you retreived messages (or headers) from the mailbox. Having
users or other processes in the mailbox deleting messages while you're doing
your thing is the largest concern. If that happens, there's almost no way
to keep things straight.
There are a couple of ways you can account for the "shifting" of message
numbers. One would be to grab all the headers and then process the
resulting query in reverse. For instance, if you have 15 messages in the
mailbox, and you delete number 13, then when you delete number 12, no
problem. It's still what you thought was the 12th message. Not so if you
do it the other way around.
Jim
----- Original Message -----
From: "cf-talk" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, January 25, 2002 5:59 PM
Subject: cfpop - Is It POOP?
> I'm running a cfpop to grab 10 message headers at a time, then runing them
> through a cfquery output to take message with subject="undeliverable" and
> run another cfpop to delete that messageNumber. I'm only grabbing 10 at a
> time and looping back because when I tried to run more, I got errors and
wh
> en I created a list of messageNumbers to delete I'd get "messageNumber not
> found".
>
>
> I am the only one with access to the mailbox. It is a hosted mailserver. I
> alternately get three different error messages:
>
> [IN-USE] failed to lock or parse or multiple access
>
> Cannot determine message count
>
> Request canceled or ignored by serverServer busy or unable to fulfill
reque
> st.
>
> ------------------------------------------------------
>
> <cfset start = "1">
> <cfloop condition = "#start# lt 2000">
> <CFPOP
> SERVER="mail.blah.com"
> USERNAME="[EMAIL PROTECTED]"
> PASSWORD="blah-de-blah"
> ACTION=GETHEADERONLY
> startrow= "#start#"
> maxrows="10"
> NAME="undeliverable"
> timeout= 5000
> >
> <cfset delRows = "0">
> <cfoutput query="undeliverable">
> <cfif #undeliverable.SUBJECT# contains "Undeliverable">
> <CFPOP
> SERVER="mail.blah.com"
> USERNAME="[EMAIL PROTECTED]"
> PASSWORD="blah-de-blah"
> ACTION=DELETE
> NAME= "delete"
> maxrows="1"
> MESSAGENUMBER = "#undeliverable.MESSAGENUMBER#"
> >
> <cfset delRows = ("#delRows#" + "1")>
> deleted: #undeliverable.messageNumber# #undeliverable.subject#<br>
> </cfif>
> </cfoutput>
> <cfset start = "#start#" + "10" - "#delRows#">
>
> </cfloop>
>
>
______________________________________________________________________
Why Share?
Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists