4 Replies Latest reply on Mar 18, 2014 10:19 AM by Dave Ferguson

    How to use CFschedule?

    gwarmonger Level 1

      I am trying to send an email with CFschedule... from what I can tell by looking at the documentation, I am doing it right. I am not getting any error messages but the email is not sending. The CFschedule is the action page of a form. When the form processed, it should set the CFschedule for another action page which sends the email. Here is the code -


      The code that fires on a form submit (I have verified that this page is being called properly)

      task ="sendemail"
      startDate ="3/18/2014"
      endDate ="3/18/2014"
      operation = "HTTPRequest"
      interval ="once"
      url = "sendemail.cfm"
      startTime = "10:43:00"

      And the action page.



          subject="Your Equipment Test"> 
      Your equipment lease is due back to CIE tomorrow.   




        • 1. Re: How to use CFschedule?
          Dave Ferguson Level 3

          Couple questions here...


          First.. Why are you using cfschedule to just send an email?  This could be more easily done in the form processor.


          Second... If you are using the cfschedule to do it what happens if 2 people submit the form at the same time?



          As for the email, check in the undelivered folder on the server for the email.  If it was unable to be sent it would be in there.





          • 2. Re: How to use CFschedule?
            gwarmonger Level 1

            It is for an inventory system. The form includes a return date for borrowing an item. When they submit the form, the cfschedule will use the return date from the form variable as the enddate attribute on the cfschedule. So...the day their equipment is due back, they recieve an email.


            My code does not reflect this yet, I hardcoded a date for testing purposes.


            And actually, I got it to work. I had to change the URL attribute to an absolute link instead of relative.



            • 3. Re: How to use CFschedule?
              gwarmonger Level 1

              By the way....see my other comment first. -   is there a better way to do what I mentioned in my other comment?



              • 4. Re: How to use CFschedule?
                Dave Ferguson Level 3

                I wouldn't do it this way at all.  What happens when you have 1000 items, or even 2, due in the future?  You would have a scheduled task for each item.  This would create a management nightmare that I wouldn't want to deal with.


                I would just run a task each day to poll for items doe that day and then send an email.  Much cleaner approach and far less prone to failure.  You could easily write code to deail with issues, resend emails, and generally recover from failures with little effort.