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

cfpop action="delete"

New Here ,
Apr 12, 2006 Apr 12, 2006

Copy link to clipboard

Copied

We would like to capture certain e-mails and save them to a database. We plan on scheduling a CF task to periodically run a script that will check an e-mail account. However, we don't want to insert a message more than once, so we want to delete it after it's inserted in the database.

I tested the scenario in MX 6 and it worked if I passed it the UID value, but not the messagenumber. In MX 7 however, the delete does not seem to work with either. Is anyone doing something similar in MX 7?

Thank you!
TOPICS
Advanced techniques

Views

1.2K

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
Community Expert ,
Apr 13, 2006 Apr 13, 2006

Copy link to clipboard

Copied

What syntax are you using? This should work in MX7

<cfpop action="delete" messagenumber="#msgNo#" server="mail.myDomain.com" timeout="180" username="usrnm" password="psswrd">


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
New Here ,
Apr 13, 2006 Apr 13, 2006

Copy link to clipboard

Copied

That is the syntax I'm using. It works fine on a server running MX 6.1, but not on one running MX 7 (we just installed the Updater too). I don't get any error messages, the e-mail just does not get deleted.

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
Community Expert ,
Apr 13, 2006 Apr 13, 2006

Copy link to clipboard

Copied

It works for me, MX7.0.1. Could we see your cfpop code?

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
New Here ,
Apr 14, 2006 Apr 14, 2006

Copy link to clipboard

Copied

Code below. This is what works on 6.1 for me (actually using messageNumber does not work on 6.1 either). If I run it twice on 6.1, no more messages are displayed (delete works). The same on 7.0.1 keeps returning all messages.

<cfpop server = "***" username = "***" password = "***" action = "getHeaderOnly" name = "GetHeaders">
<h3>Message Headers in Your Inbox</h3>
<p>Number of Records:
<cfoutput>#GetHeaders.recordCount#</cfoutput></p>

<ul>
<cfoutput query = "GetHeaders">
<li>Row: #currentRow#: From: #From# -- Subject: #Subject# -- UID: #UID#</li>
<cfpop server = "***" username = "***" password = "***" action = "delete" UID="#UID#">
</cfoutput>
</ul>

If it's not the code maybe it's a setting I'm not aware of?...

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
Community Expert ,
Apr 14, 2006 Apr 14, 2006

Copy link to clipboard

Copied

There might be some complication in your approach. I think Coldfusion creates a cfpop query object only when the action is getHeaderOnly or getAll, not when the action is delete. To test this hypothesis, run the following

<cfpop action="delete" name="deleter" messagenumber="1" server="mail.mydomain.com" timeout="180" username="myself" password="df56s7">
<cfif isdefined("deleter")>
deleter defined
<cfelse>
deleter undefined
</cfif>

Your <cfpop action="delete"> might not be picking up values from the GetHeaders query. What happens when you run the following code instead

<cfset i=0>
<cfoutput query = "GetHeaders">
<cfset i=i+1>
<li>Row: #currentRow#: From: #From# -- Subject: #Subject# -- UID: #UID#</li>
<cfpop server = "***" username = "***" password = "***" action = "delete" messagenumber="#i#">
</cfoutput>

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
New Here ,
Apr 14, 2006 Apr 14, 2006

Copy link to clipboard

Copied

When I ran the deleter test, I got "deleter undefined". Running the second block of code output the messages but did not delete them.

Thanks for trying to help. I'm thinking more and more there is another setting (unfortunately I have no idea related to what) impacting this.

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
Community Expert ,
Apr 14, 2006 Apr 14, 2006

Copy link to clipboard

Copied

And if you remove the delete-action from the GetHeaders scope altogether? That is,

<cfset n=#GetHeaders.recordCount#>
<cfloop index="i" from="1" to="#n#">
<cfpop server = "***" username = "***" password = "***" action = "delete" messagenumber="#i#">
</cfloop>


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
New Here ,
Apr 14, 2006 Apr 14, 2006

Copy link to clipboard

Copied

Same result. The messages don't get deleted...

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
Community Expert ,
Apr 15, 2006 Apr 15, 2006

Copy link to clipboard

Copied

Reduce the timeout from 180 to, say, 30 seconds. The delete-action might be idling about, because it has 3 minutes to play, and yet you're checking after 30 seconds.

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
New Here ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

quote:

Originally posted by: BKBK
Reduce the timeout from 180 to, say, 30 seconds. The delete-action might be idling about, because it has 3 minutes to play, and yet you're checking after 30 seconds.



Just tried 30 seconds, still nothing.

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
Engaged ,
Apr 17, 2006 Apr 17, 2006

Copy link to clipboard

Copied

ioanab : What mail server are you using, and do you have admin access to it?

There may be a way to do what you want w/o the POP script if your mail server allows programmable actions on the email account.

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
New Here ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

LATEST
quote:

Originally posted by: SafariTECH
ioanab : What mail server are you using, and do you have admin access to it?

There may be a way to do what you want w/o the POP script if your mail server allows programmable actions on the email account.

We are using GroupWise and I do not have admin access to it.

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