" . $record['authors'] . "," .
$record['email'] . "," . $record['borrower_name'] . "," .
$record['checkout_date'] . "
";
$days_elapsed = compute_days_elapsed($record['checkout_date']);
if ($days_elapsed > 14)
{
echo "notify overdue -- send email
";
$checkout_date = date_create($record['checkout_date']);
$date_interval = new DateInterval('P14D'); // create 14 days interval; P for period; D for days
$due_date = date_add($checkout_date, $date_interval);
try {
send_email($record['borrower_name'], $record['email'], $record['title'], $due_date);
} catch (Exception $e) {
echo "Unable to send mail
";
}
}
else
echo "not due yet
";
}
?>
format("y m d") . " : " . $date2->format("y m d") . "
";
$days_elapsed = date_diff($date1, $date2);
return $days_elapsed->format("%r%a");
// %r -- sign "-" when negativew, empty when positive
// %a -- total number of days
}
?>
isSMTP(); // Set mailer to use SMTP
$mail->Mailer = "smtp";
// set required parameters for making an SMTP connection
$mail->SMTPAuth = TRUE; // Enable SMTP authentication
$mail->SMTPSecure = "tls"; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->Host = "smtp.gmail.com"; // Specify main and backup SMTP servers
$mail->Username = "your-username@gmail.com"; // SMTP username
$mail->Password = "your-password"; // SMTP password
//Recipients
$mail->setFrom('your-username@gmail.com', 'webPL Library'); // email address and name (name is optional)
$mail->addAddress($send_to_email);
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'webPL Library: Overdue notification';
$mail->Body = 'Hi ' . $send_to_name . ', The book entitled ' . $book_title .
' was due on ' . $due_date->format("d-M-Y") . '. ';
if ($mail->send()) // return true on success, false on error
echo "Sending notification successfully
";
else
echo "Failed
";
} catch (Exception $e) {
echo 'Sorry, your comment or suggestion could not be sent. Please contact admin';
}
}
?>