function display_message($auth_user, $accountid, $messageid, $fullheaders) { //show an email message global $table_width; $buttons = array(); $buttons[0] = 'reply'; $buttons[1] = 'reply-all'; $buttons[2] = 'forward'; $buttons[3] = 'delete'; if ($fullheaders) { $buttons[4] = 'hide-headers'; } else { $buttons[4] = 'show-headers'; } $message = retrieve_message($auth_user, $accountid, $messageid, $fullheaders); if (sizeof($message) == 0) { echo "cannot retrieve message number {$messageid}" . '.<br /><br /><br /><br /><br />'; } else { $message = pretty_all($message); ?> <table width = <?php echo $table_width; ?> cellpadding = 4 cellspacing = 0 border = 0> <tr> <td bgcolor = '#cccccc'> <b> Subject: </b> </td> <td bgcolor = '#cccccc'> <b> <?php echo $message[subject]; ?> </b> </td> </tr> <tr> <td bgcolor = '#cccccc'> <b> From: </b> </td> <td bgcolor = '#cccccc'> <b> <?php echo $message[fromaddress]; ?> </b> </td> </tr> <tr> <td bgcolor = '#cccccc'> <b> To: </b> </td> <td bgcolor = '#cccccc'> <b> <?php echo $message[toaddress]; ?> </b> </td> </tr> <tr> <td bgcolor = '#cccccc'> <b> CC: </b> </td> <td bgcolor = '#cccccc'> <b> <?php echo $message[ccaddress]; ?> </b> </td> </tr> <tr> <td bgcolor = '#cccccc'> <b> Received: </b> </td> <td bgcolor = '#cccccc'> <b> <?php echo $message[date]; ?> </b> </td> </tr> </table> <?php display_toolbar($buttons, "&messageid={$messageid}"); ?> <table width = <?php echo $table_width; ?> cellpadding = 4 cellspacing = 0 border = 0> <tr> <td bgcolor = '#cccccc'> <?php echo $message[fullheaders]; ?> </td> </tr> </table> <table width = <?php echo $table_width; ?> cellpadding = 4 cellspacing = 0 border = 0> <tr> <td> <?php echo $message[body]; ?> </td> </tr> </table> <?php } }
function display_message($auth_user, $accountid, $messageid, $fullheaders) { //show an email message global $table_width; $buttons = array(); $buttons[0] = 'reply'; $buttons[1] = 'reply-all'; $buttons[2] = 'forward'; $buttons[3] = 'delete'; if ($fullheaders) { $buttons[4] = 'hide-headers'; } else { $buttons[4] = 'show-headers'; } $message = retrieve_message($auth_user, $accountid, $messageid, $fullheaders); if (sizeof($message) == 0) { echo "<p style=\"padding-bottom: 100px\">Cannot retrieve message number " . $messageid . ".</p>"; } else { $message = pretty_all($message); } ?> <table width="<?php echo $table_width; ?> " cellpadding="4" cellspacing="0" border="0"> <tr> <td bgcolor="#cccccc"><strong>Subject:</strong></td> <td bgcolor="#cccccc"><strong><?php echo $message[subject]; ?> </strong></td> </tr> <tr> <td bgcolor="#cccccc"><strong>From:</strong></td> <td bgcolor="#cccccc"><strong><?php echo $message[fromaddress]; ?> </strong></td> </tr> <tr> <td bgcolor="#cccccc"><strong>To:</strong></td> <td bgcolor="#cccccc"><strong><?php echo $message[toaddress]; ?> </strong></td> </tr> <tr> <td bgcolor="#cccccc"><strong>CC:</strong></td> <td bgcolor="#cccccc"><strong><?php echo $message[ccaddress]; ?> </strong></td> </tr> <tr> <td bgcolor="#cccccc"><strong>Received:</strong></td> <td bgcolor="#cccccc"><strong><?php echo $message[date]; ?> </strong></td> </tr> </table> <?php display_toolbar($buttons, "&messageid={$messageid}"); ?> <table width="<?php echo $table_width; ?> " cellpadding="4" cellspacing="0" border="0"> <tr> <td bgcolor="#cccccc"> <?php echo $message[fullheaders]; ?> </td> </tr> </table> <table width="<?php echo $table_width; ?> " cellpadding="4" cellspacing="0" border="0"> <tr> <td> <?php echo $message[body]; ?> </td> </tr> </table> <?php }
// Буферизуем вывод для каждого пользователя echo "======================"; // Выводим данные о сообщении $h = mp_header($mbox, $j); print_ra($h); if ($h['Deleted']) { // Если сообщение удалено echo "Сообщение удалено!\n"; } elseif (!isset($h['subject'])) { echo "Тема не задана!\n"; } else { $module = 'app_' . $h['subject'] . '.php'; // Имя модуля if (file_exists($module)) { // Если модуль существует list($message, $charset) = retrieve_message($mbox, $j); // Извлекаем сообщение echo "Кодировка: {$charset}\n"; $message = mp_explode($message); // Преобразуем imap_delete($mbox, $j); // сразу удаляем письмо на случай, если модуль вызовет ошибки $user = $message[1][0]; $pw = trim($message[2][0]); if ($user = $message[1][0]) { // Считываем пользователя echo "Пользователь '{$user}' - "; $user_conf = "conf_{$user}.php"; // Настройки пользователя if (file_exists($user_conf)) { // Если настройки существуют