Location: PHPKode > projects > Tinbox > systemadmin/maildue.php
<?php
// Checks mails due for delivery
require("../config.php");

$link = mysql_connect(DB_SERVER, DB_USER, DB_PSW);
mysql_select_db(DB_DB);

echo "Mails due for today (".date("D",time()).") <br>";

// select modules due for mailing this day & hour
$sql="select st.mailtime,  st.name as student, st.email, co.title as course, mo.title as module, mo.chapter from class_schedule sc, class_main cl, account_students st, course_main co, course_modules mo, account_groups gr, account_main ac where sc.active=1 and sc.class_idx=cl.idx and cl.student_idx=st.idx and cl.group_idx=gr.idx and sc.mod_idx=mo.idx and mo.course_idx=co.idx and ac.idx=st.account_idx and st.mail".date("D",time())."=1 order by st.mailtime";
$result = mysql_query($sql);
if($row = mysql_fetch_object($result))
        {
        do      {
                echo $row->student."<b> email:</b>".$row->email."<b> at </b>".$row->mailtime."<b> Mod:</b>".$row->chapter.".".$row->module.", ".$row->course."<br>";
                }while($row = mysql_fetch_object($result));
        }
else
        echo "No mails to send";
?>

Return current item: Tinbox