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
https://forums.phpfreaks.com/topic/144845-modify-reminder-send-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.