12 Replies Latest reply on Apr 18, 2006 10:22 AM by ioanab

    cfpop action="delete"

    ioanab
      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!
        • 1. Re: cfpop action="delete"
          BKBK Adobe Community Professional & MVP
          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">


          • 2. Re: cfpop action=&quot;delete&quot;
            ioanab Level 1
            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.
            • 3. cfpop action=&quot;delete&quot;
              BKBK Adobe Community Professional & MVP
              It works for me, MX7.0.1. Could we see your cfpop code?

              • 4. Re: cfpop action=&quot;delete&quot;
                ioanab Level 1
                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?...
                • 5. cfpop action=&quot;delete&quot;
                  BKBK Adobe Community Professional & MVP
                  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>

                  • 6. Re: cfpop action=&quot;delete&quot;
                    ioanab Level 1
                    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.
                    • 7. Re: cfpop action=&quot;delete&quot;
                      BKBK Adobe Community Professional & MVP
                      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>


                      • 8. Re: cfpop action=&quot;delete&quot;
                        ioanab Level 1
                        Same result. The messages don't get deleted...
                        • 9. Re: cfpop action=&quot;delete&quot;
                          BKBK Adobe Community Professional & MVP
                          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.

                          • 10. Re: cfpop action=&quot;delete&quot;
                            SafariTECH Level 1
                            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.
                            • 11. Re: cfpop action=&quot;delete&quot;
                              ioanab Level 1
                              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.
                              • 12. Re: cfpop action=&quot;delete&quot;
                                ioanab Level 1
                                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.