Jump to content

Modify reminder send class


sonny

Recommended Posts

Hi Board

 

The problem is any reminders which do not send within their

hour and date, server down etc, will never get sent or deleted

from the database.

 

I have been trying to modify the code below, to get all unsent past

reminders to go out the next time the reminder script runs. but am

having no luck.

 

Any help on this is appreciated

Thanks

 

----------------------------

function send ($stamp)

  {

    global $db, $config;

 

    list ($day, $month, $year, $hour) = array(date('j', $stamp), date('n', $stamp), date('Y', $stamp), date('G', $stamp));

    $query = "SELECT * FROM reminders WHERE  date_day=$day AND date_month=$month AND date_year=$year AND date_hour=$hour";

    $result = $db->query($query);

    if(DB::iserror($result))

    {

      die("Error in send.<br>SQL: $query<br>" . $result->getMessage());

    }

 

    $num_rows = $result->numRows();

 

    for ($i = 0; $i < $num_rows; $i++)

    {

      $row = $result->fetchRow(DB_FETCHMODE_ASSOC);

 

      $newdate = array();

 

      $to  = $row['email_to'];

      $body = wordwrap($row['email_body']);

      $subj = $config['mail_subj_prepend'] . ' ' . $row['email_subject'];

 

      if ($to != '')

      {

        if (mail($to, $subj, $body, 'From: ' . $config['mail_from']))

        {

          echo "\n(ID:{$row['id']}) E-mail Reminder sent to: <$to>";

        }

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.