Example #1
0
/**
*	purpose	email scheduler, this is the actual sending of all emails
*	params		non, messages are taken from tmessage
*	returns		nothing or failure message
*/
function _sendpendingmails()
{
    global $dbi, $RZ_server, $mailhead;
    // M.id,S.msgstatus,M.cre_user,M.cre_date,M.mgroup_id,MG.mgroupname,M.recipient,M.msgurl,M.msgbody
    $ret = 0;
    // fetch ALL pending messages
    $RS = DB_listMessage($dbi, '', '', 1);
    // execute mailer , check if we have a group to send to or a pre-stored single recipient ...
    // debug($RS);
    foreach ($RS as $M) {
        if ($M[4] > 0) {
            $to_adr = _GetMailAdressForGroup($M[4]);
        } else {
            $to_adr = $M[6];
        }
        // store or update the recipient list in tmessage -> recipient, else the INBOX is always empty ...
        $ret = mail($to_adr, 'LSDB Liga Message', $M[8] . '\\n' . 'System Link\\n' . $RZ_server . $M[7], $mailhead);
        if ($ret == 1) {
            $ret = DB_setMessageStatus($M[0], '', '', 2, $to_adr);
        } else {
            debug('Error sending mails ' . $M[8] . '\\n' . $M[7]);
        }
    }
}
Example #2
0
/**
*	purpose	this is the system outbox, all messages send by the system
*	params	
*	returns		HTML table with action buttons per row
*/
function _showOutbox()
{
    global $dbi, $usertoken;
    if ($usertoken['usertype_id'] < 5) {
        die_red('Err:Msg95:WrongUser');
    }
    $RS = DB_listMessage($dbi);
    $HEAD = '';
    $ROWS = '';
    $ROWS = RecordsetToDataTable($RS, array(1, 2, 3, 5, 6, 7, 8), array('delmessage', 'setmessage'), array(array(0), array(0)), array('Del', 'Chg'));
    $aTH = array('Status', 'Absender', 'Datum', 'Gruppe', 'Empf&auml;nger', 'Link', 'Nachricht', 'Aktion', 'Aktion');
    $HEAD = ArrayToTableHead($aTH);
    // OUTPUT //
    echo '<script type="text/javascript">$("#pagetitle").html("Outbox");</script>';
    echo '<div id=\'mailadm\'>';
    echo '<table><tr><td>' . _button('Send Pending Liga', 'msgsendall()') . '</td><td>' . _button('Purge All', 'delall()') . '</td></tr></table>';
    echo '</div>';
    echo OpenTable('maillist', 1);
    echo $HEAD . $ROWS;
    echo CloseTable(1);
}