• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfbreak?

Guest
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

Hi i have a cfloop inside a scheduled task, which loops though cfpop emails

i get information from the body of the email (which all email i recive have the same format),

cfloop query="popemails"
cfif message id (which is in the body of the email) matches a record in my table
then delete the email
else
process the email with code

this i what i am trying to do, but for some reason some times if there is a match in the table the email is still processed causing duplication.

do i need to use cfbreak after i delete the email, would this start the loop again? as it is inside a scheduled task?
TOPICS
Advanced techniques

Views

552

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

How are you extracting the message id from the e-mail? Do you use the Trim( ) function to remove any possible leading or trailing spaces? CFBREAK will take you out of the loop.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

HI i dont need to use trim as the message id is generated by a windows application,no spaces are every present!!

so when i check the log i can see some duplicates of the messageid are the same right after each other,
if i use cfbreak and it takes me out of the loop, would the loop start over again or would the schedule task have to run again?

instead of cfbreak is there a way to delete the email then restart the scheduled task page?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

Does the following represent your process flow?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 23, 2007 Nov 23, 2007

Copy link to clipboard

Copied

ok many thanks

when you say "if you know how many Windows emaliIds you have"

each email i receive has a different unique windows email id and there is only one per email..

i think my current code maybe processing the email twice in some cases, thats why i am putting this check in place!!

so which would be the best option for me to use?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 24, 2007 Nov 24, 2007

Copy link to clipboard

Copied

Probably the second one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 24, 2007 Nov 24, 2007

Copy link to clipboard

Copied

ok thanks

i am just worried why i am getting duplicates from my current code which i have attached below, is it possible that when i do the query GetMessage that if a messageID is inserted in the previous loop is not yet in there?

does my code look ok?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 24, 2007 Nov 24, 2007

Copy link to clipboard

Copied

Something to look at - when you delete an e-mail, your ACTION and MESSAGENUMBER attributes do not have a space between them: ACTION="Delete"MESSAGENUMBER="1">

Do a CFDUMP after your first CFPOP, and a CFOUTPUT after your getMessage CFQUERY. This debug results should show you what's going on. See code below.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 24, 2007 Nov 24, 2007

Copy link to clipboard

Copied

LATEST
> <cfset str_idd = trim(listlast(listgetat(mymessage, 7, "|"), "~"))>
> WHERE MainAppMessageID = '#str_idd#'

Isn't the message number already a column in the POP query : queryname.messagenumber

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation