コード例 #1
0
 public function send_reply($to, $subject, $content, $reply_id)
 {
     // $this->open_stream();
     $file_path = process_attachments();
     $mail = compose_message($to, $subject, $content, $file_path, $reply_id);
     if (!$mail->send()) {
         exit("problemo");
     } else {
         return true;
     }
 }
コード例 #2
0
ファイル: email_parser.php プロジェクト: riansopian/hesk
function process_results($result, $tempdir)
{
    global $hesk_settings;
    $r = array();
    // from address and name
    $r["from"] = process_addrname_pairs($result["From"]);
    // to  address and name
    $r["to"] = process_addrname_pairs($result["To"]);
    // cc address and name
    if (array_key_exists("Cc", $result)) {
        $r["cc"] = process_addrname_pairs($result["Cc"]);
    } else {
        $r["cc"] = array();
    }
    // bcc address and name
    if (array_key_exists("Bcc", $result)) {
        $r["bcc"] = process_addrname_pairs($result["Bcc"]);
    } else {
        $r["bcc"] = array();
    }
    // reply-to address and name
    if (array_key_exists("Reply-to", $result)) {
        $r["reply-to"] = process_addrname_pairs($result["Reply-to"]);
    } else {
        $r["reply-to"] = array();
    }
    // subject and subject encoding
    $r["subject"] = $result["Subject"];
    $r["subject_encoding"] = isset($result["SubjectEncoding"]) ? strtoupper($result["SubjectEncoding"]) : "";
    // Message encoding
    $r["encoding"] = isset($result["Encoding"]) ? strtoupper($result["Encoding"]) : "";
    // If message is saved in a file get it from the file
    if (!isset($result["Data"]) && isset($result["DataFile"])) {
        $result["Data"] = file_get_contents($result["DataFile"]);
    }
    // Convert to UTF-8 before processing further
    if ($r["encoding"] != 'UTF-8') {
        $result["Data"] = iconv($r["encoding"], 'UTF-8', $result["Data"]);
        $r["encoding"] = 'UTF-8';
    }
    // the message shall be converted to text if it is in html
    if ($result["Type"] === "html") {
        $r["message"] = convert_html_to_text($result["Data"]);
    } else {
        $r["message"] = $result["Data"];
    }
    // Message attachments
    $r["attachments"] = array();
    if ($hesk_settings['attachments']) {
        // File attachments
        if (array_key_exists("Attachments", $result)) {
            $r["attachments"] = array_merge($r["attachments"], process_attachments($result["Attachments"]));
        }
        // Save embedded files (for example embedded images)
        if ($hesk_settings['save_embedded'] && array_key_exists("Related", $result)) {
            $r["attachments"] = array_merge($r["attachments"], process_attachments($result["Related"]));
        }
    }
    // Name of the temporary folder
    $r["tempdir"] = $tempdir;
    return $r;
}