if (strpos("." . $toemail, "<")) { $toemails[] = preg_replace("/(.*)<(.*)>/", "\\2", $toemail); } else { $toemails[] = $toemail; } } $to = explode(",", $bcc); foreach ($to as $toemail) { if (strpos("." . $toemail, "<")) { $toemails[] = preg_replace("/(.*)<(.*)>/", "\\2", $toemail); } else { $toemails[] = $toemail; } } $to = implode(",", $toemails); processPipedTicket($to, $fromname, $fromemail, $subject, $body, $attachments); /** * +----------------------------- IMPORTANT ------------------------------+ * | Usage of this class compared to native php extensions such as | * | mailparse or imap, is slow and may be feature deficient. If available| * | you are STRONGLY recommended to use the php extensions. | * +----------------------------------------------------------------------+ * * Mime Decoding class * * This class will parse a raw mime email and return * the structure. Returned structure is similar to * that returned by imap_fetchstructure(). * * USAGE: (assume $input is your raw email) *
fwrite($fp, $attachmentdata); fclose($fp); } else { $msgBody .= "" . "\n" . "\nAttachment " . $filename . " blocked - file type not allowed."; } $cou++; } } $attachmentslist = substr($attachmentslist, 0, 0 - 1); $fromemail = $header_info["fromAddr"]; if ($header_info["replyTo"]) { $fromemail = $header_info["replyTo"]; } $header_info["subject"] = str_replace("{", "[", $header_info["subject"]); $header_info["subject"] = str_replace("}", "]", $header_info["subject"]); processPipedTicket($header_info["to"] . "" . "," . $login, $header_info["fromName"], $fromemail, $header_info["subject"], $msgBody, $attachmentslist); $sections = $attachments = $header_info = $fromemail = $attachmentslist = $attachmentdata = $attachmentfilename = ""; imap_delete($mbox, $msgno); $msgno += 1; } } imap_expunge($mbox); imap_close($mbox); } } function get_mime_type(&$structure) { $primary_mime_type = array("TEXT", "MULTIPART", "MESSAGE", "APPLICATION", "AUDIO", "IMAGE", "VIDEO", "OTHER"); if ($structure->subtype) { return $primary_mime_type[(int) $structure->type] . "/" . $structure->subtype; }