3 Replies Latest reply on Aug 15, 2006 4:10 PM by <newbie />

    Mail and file delete

    only1reddog
      I'm trying to mail a file and then delete it in same page.
      The file gets deleted before the file is attached and sent completely.
      Can I make the delete wait untill the attach is completed?
        • 1. Re: Mail and file delete
          Level 7
          Not sure if this is the best Idea, but since mail generated by
          coldfusion goes into the 'mail' folder under the coldfusion directories
          before it is sent out. One could theoretically put a watch on the
          folder and not process anything until the mail message is sent, when it
          disappears from the folder.

          Something like this pseudo-code.

          <cfloop condition="#fileExists(mailFile.in.mail.folder)#">
          sleep for a couple of seconds.
          </cfloop>


          only1reddog wrote:
          > I'm trying to mail a file and then delete it in same page.
          > The file gets deleted before the file is attached and sent completely.
          > Can I make the delete wait untill the attach is completed?
          • 2. Re: Mail and file delete
            Dan Bracuk Level 5
            I remember trying to do that. Didn't work. What we do instead is to run a scheduled job that deletes all those files.
            • 3. Re: Mail and file delete
              <newbie /> Level 1

              > I'm trying to mail a file and then delete it in same page.

              Have you tried <cfmailparam ... contentID="..." disposition="attachment" />
              and then deleting it from a subsequent page?