Delayed Email

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wes Bailey

    Delayed Email

    I am being asked to send an email out after a form has been filled out
    and submitted. The requirement though is that this email gets sent
    out an hour after the form has been filled out. The user is also
    supposed to be directed to another static html page after they have
    filled out the form. Anyone have any clever ideas to get around the
    buffering issues that are caused when using the sleep() command?

    I would like to implement a PHP only solution if possible. Keep in
    mind that we are using a Sun Cobalt appliance with a limited PHP
    4.0.6. Any suggestions would be greatly appreciated.

    Thanks!

    Wes
  • Tom Thackrey

    #2
    Re: Delayed Email


    On 1-Oct-2003, wesley_bailey@y ahoo.com (Wes Bailey) wrote:
    [color=blue]
    > I am being asked to send an email out after a form has been filled out
    > and submitted. The requirement though is that this email gets sent
    > out an hour after the form has been filled out. The user is also
    > supposed to be directed to another static html page after they have
    > filled out the form. Anyone have any clever ideas to get around the
    > buffering issues that are caused when using the sleep() command?
    >
    > I would like to implement a PHP only solution if possible. Keep in
    > mind that we are using a Sun Cobalt appliance with a limited PHP
    > 4.0.6. Any suggestions would be greatly appreciated.[/color]

    sleep() is a bad idea for many reasons, not the least of which is a server
    restart will cause the emails to never be sent.

    I would build a table of the unsent emails and the time they are due to be
    sent, then I would setup a cron job to send and delete the time ready emails
    from the table. You just have to pick an interval for the cron job.

    --
    Tom Thackrey

    Comment

    • muhadib

      #3
      Re: Delayed Email

      Wes Bailey wrote:
      [color=blue]
      > I am being asked to send an email out after a form has been filled out
      > and submitted. The requirement though is that this email gets sent
      > out an hour after the form has been filled out. The user is also
      > supposed to be directed to another static html page after they have
      > filled out the form. Anyone have any clever ideas to get around the
      > buffering issues that are caused when using the sleep() command?
      >
      > I would like to implement a PHP only solution if possible. Keep in
      > mind that we are using a Sun Cobalt appliance with a limited PHP
      > 4.0.6. Any suggestions would be greatly appreciated.
      >
      > Thanks!
      >
      > Wes[/color]

      sleep is not possible, i don't explain why, you will find out!
      What you can do ist a kind of cron job in your index.php.
      Everytime the page is visited the system checks if it has to send a mail
      (after the hour is over), although i wouldn't be exact timing and if
      there are not many ppl on this site i can happen that the mail will be
      sent days, months, years after.


      Easiest would be a real cronjob on the machine!

      cy

      Comment

      Working...