コード例 #1
0
ファイル: receiveEmail.php プロジェクト: cjbayliss/alloc
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) {
                    inbox::convert_email_to_new_task($email_receive, true);
                } else {
                    $email_receive->mark_seen();
                    // mark it seen so we don't poll for it again
                    alloc_error("Could not create a task from this email. Email was not sent by a staff member. Email resides in INBOX.");
                }
                // Else if we have a key, append to comment
            } else {
                // Skip over emails that are from alloc. These emails are kept only for
                // posterity and should not be parsed and downloaded and re-emailed etc.
                if (same_email_address($email_receive->mail_headers["from"], ALLOC_DEFAULT_FROM_ADDRESS)) {
                    $email_receive->mark_seen();
                    $email_receive->archive();
                } else {
                    inbox::process_one_email($email_receive);
                }
コード例 #2
0
ファイル: inbox.inc.php プロジェクト: cjbayliss/alloc
 function process_email_to_task($req = array())
 {
     global $TPL;
     $info = inbox::get_mail_info();
     $email_receive = new email_receive($info);
     $email_receive->open_mailbox($info["folder"]);
     $email_receive->set_msg($req["id"]);
     $email_receive->get_msg_header();
     inbox::convert_email_to_new_task($email_receive);
     $email_receive->expunge();
     $email_receive->close();
 }