if ($posting) { error_debug("handling bb post"); format_post_bits("isAdmin,temporary"); $id = db_enter("bulletin_board_topics", "title |description isAdmin temporary"); db_query("UPDATE bulletin_board_topics SET threadDate = GETDATE() WHERE id = " . $id); if ($_POST["isAdmin"] == "'1'") { //send admin email //get topic $r = db_grab("SELECT \n\t\t\t\tt.title,\n\t\t\t\tt.description,\n\t\t\t\tu.userID,\n\t\t\t\tISNULL(u.nickname, u.firstname) firstname,\n\t\t\t\tu.lastname,\n\t\t\t\tt.createdOn\n\t\t\t\tFROM bulletin_board_topics t\n\t\t\t\tJOIN intranet_users u ON t.createdBy = u.userID\n\t\t\t\tWHERE t.id = " . $id); //construct email $message = drawEmailHeader(); $message .= drawServerMessage("<b>Note</b>: This is an Administration/Human Resources topic from the <a href='http://" . $server . "/bulletin_board/'>Intranet Bulletin Board</a>. For more information, please contact the <a href='mailto:hrpayroll@seedco.org'>Human Resources Department</a>."); $message .= '<table class="center">'; $message .= drawHeaderRow("Email", 2); $message .= drawThreadTop($r["title"], $r["description"], $r["userID"], $r["firstname"] . " " . $r["lastname"], $r["createdOn"]); $message .= '</table>' . drawEmailFooter(); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: " . $_josh["email_default"] . "\r\n"; //get addresses & send $users = db_query("SELECT email FROM intranet_users WHERE isactive = 1"); while ($u = db_fetch($users)) { mail($u["email"], $r["title"], $message, $headers); } } syndicateBulletinBoard(); url_change(); } drawTop(); echo drawSyndicateLink("bb"); ?>
function email_user($address, $title, $content, $colspan = 1) { global $_josh; $message = drawEmailHeader() . drawTableStart() . drawHeaderRow($title, $colspan) . $content . drawTableEnd() . drawEmailFooter(); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: " . $_josh["email_default"] . "\r\n"; if (!mail($address, $title, $message, $headers)) { error_handle("Couldn't Send Email", "The message to " . $address . " was rejected by the mailserver for some reason", true); } }