define("NO_AUTH", 1); require_once "../alloc.php"; singleton("errors_fatal", false); singleton("errors_format", "text"); singleton("errors_logged", false); singleton("errors_thrown", true); singleton("errors_haltdb", true); $nl = "<br>\n"; $info = inbox::get_mail_info(); if (!$info["host"]) { alloc_error("Email mailbox host not defined, assuming email receive function is inactive.", true); } $email_receive = new email_receive($info); $email_receive->open_mailbox(config::get_config_item("allocEmailFolder")); $email_receive->check_mail(); $num_new_emails = $email_receive->get_num_new_emails(); if ($num_new_emails > 0) { $msg_nums = $email_receive->get_new_email_msg_uids(); print $nl . date("Y-m-d H:i:s") . " Found " . count($msg_nums) . " new/unseen emails." . $nl; foreach ($msg_nums as $num) { // Errors from previous iterations shouldn't affect processing of the next email db_alloc::$stop_doing_queries = false; $email_receive->set_msg($num); $email_receive->get_msg_header(); $keys = $email_receive->get_hashes(); try { // If no keys if (!$keys) { // If email sent from a known staff member $from_staff = inbox::change_current_user($email_receive->mail_headers["from"]); if ($from_staff) {
} } } return $f; } } // Tests if (basename($_SERVER["PHP_SELF"]) == "email_receive.inc.php") { define("NO_AUTH", 1); require_once "alloc.php"; //require_once("emailsettings.php"); $num = 30; $e = new email_receive($info); $e->open_mailbox("INBOX"); echo "\nNum emails: " . $e->get_num_emails(); echo "\nNew emails: " . $e->get_num_new_emails(); echo "\ncheck_mail(): " . str_replace("\n", " ", print_r($e->mail_info, 1)); echo "\nget_new_email_msg_uids(): " . str_replace("\n", " ", print_r($e->get_new_email_msg_uids(), 1)); echo "\nget_all_email_msg_uids(): " . str_replace("\n", " ", print_r($e->get_all_email_msg_uids(), 1)); //exit(); echo "\nget_emails_UIDs_search(): " . str_replace("\n", " ", print_r($e->get_emails_UIDs_search("SUBJECT alloc"), 1)); //echo "\nget_msg_header(): ".str_replace("\n"," ",print_r($e->get_msg_header($num),1)); echo "\n"; $e->set_msg($num); $e->load_structure(); echo "\nload_structure(): " . str_replace(" ", " ", print_r($e->mail_structure, 1)); echo "\nget_charset(): " . $e->get_charset(); //exit(); list($h, $b) = $e->get_raw_email_by_msg_uid($num); //echo "\nget_raw_email_by_msg_uid(): "."HEADER: ".$h."\nBODY: ".$b; echo "\nsave_email(): " . $e->save_email();