Beispiel #1
0
// Read an email from stdin
while (FALSE !== ($line = fgets(STDIN))) {
    $email[] = $line;
}
// Nuke any mbox header that sendmail/postfix may have prepended.
if ($email[0] == "") {
    array_shift($email);
}
if (preg_match("/^From /i", $email[0])) {
    array_shift($email);
}
$email = implode("", (array) $email);
$email or alloc_error("Empty email message, halting.");
$email_receive = new email_receive($info);
$email_receive->open_mailbox(config::get_config_item("allocEmailFolder"));
$email_receive->set_msg_text($email);
$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(); in alouy we want the emails to still appear new (as opposed to alloc with receiveEmail.php)
            $email_receive->archive();
        }
        // Else if we have a key, append to comment
    } else {