0) { while ($row = db_assoc($result['result'])) { if (is_array($row)) { $recipients[] = $row['username']; } } } $recipients = array_unique($recipients); if (count($recipients)>0) { mb_internal_encoding("UTF-8"); $b_name = mb_encode_mimeheader($_POST['name'], 'UTF-8', 'Q'); $b_subject = mb_encode_mimeheader($_POST['subject'], 'UTF-8', 'Q'); $b_message = chunk_split(base64_encode($_POST['message'])); $serverName = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : php_uname('n'); // ?? $i = 0; foreach ($recipients as $rcpt) { $fTo = $rcpt; $fHeaders = 'To: ' . $fTo . "\n"; $fHeaders .= 'From: ' . $b_name . ' <' . $smtp_from_email . ">\n"; $fHeaders .= 'Subject: ' . $b_subject . "\n"; $fHeaders .= 'MIME-Version: 1.0' . "\n"; $fHeaders .= 'Content-Type: text/plain; charset=UTF-8' . "\n"; $fHeaders .= 'Content-Transfer-Encoding: base64' . "\n"; $fHeaders .= 'Date: ' . date('r', time()) . "\n"; $fHeaders .= 'Message-ID: <' . microtime(true) . '-' . md5($smtp_from_email . $fTo) . "@{$serverName}>\n\n"; $fHeaders .= $b_message; if (!smtp_mail($fTo, $smtp_from_email, $fHeaders)) { flash_error(Config::lang_f('pSendmail_result_error', $fTo)); } else { flash_info(Config::lang_f('pSendmail_result_success', $fTo)); } } } flash_info($PALANG['pBroadcast_success']); $smarty->assign('smarty_template', 'message'); $smarty->display('index.tpl'); // echo '
'.$PALANG['pBroadcast_success'].'
'; } } if ($_SERVER['REQUEST_METHOD'] == "GET" || $error == 1) { $smarty->assign('allowed_domains', $allowed_domains); $smarty->assign('smtp_from_email', $smtp_from_email); $smarty->assign('error', $error); $smarty->assign('smarty_template', 'broadcast-message'); $smarty->display('index.tpl'); // include ("templates/broadcast-message.tpl"); } /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */