![]() |
![]() |
![]() ![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 237 Pomógł: 17 Dołączył: 1.11.2007 Skąd: Zielona Góra Ostrzeżenie: (0%) ![]() ![]() |
Witam mam taki problem otóz próbuje wyświetlić treść maila ściagnietego z pop3. maile wyswietla mi ok jak sa tekstowe bez wstawek htmla ale jak juz pojawi sie html z obrazkami to linki do zdjęć wygladają dziwnie. oto mój kod :
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; } return "TEXT/PLAIN"; } function get_part($stream, $msg_number, $mime_type, $structure = false,$part_number = false) { if(!$structure) { $structure = imap_fetchstructure($stream, $msg_number); } if($structure) { if($mime_type == get_mime_type($structure)) { if(!$part_number) { $part_number = "1"; } $text = imap_fetchbody($stream, $msg_number, $part_number); if($structure->encoding == 3) { return imap_base64($text); } else if($structure->encoding == 4) { return imap_qprint($text); } else { return $text; } } if($structure->type == 1) /* multipart */ { while(list($index, $sub_structure) = each($structure->parts)) { if($part_number) { $prefix = $part_number . '.'; } $data = get_part($stream, $msg_number, $mime_type, $sub_structure,$prefix . ($index + 1)); if($data) { return $data; } } // END OF WHILE } // END OF MULTIPART } // END OF STRUTURE return false; } $dataTxt = get_part($mbox, $msgno, "TEXT/PLAIN"); // GET HTML BODY $dataHtml = get_part($mbox, $msgno, "TEXT/HTML"); if ($dataHtml != "") { $msgBody = transformHTML($dataHtml); $mailformat = "html"; } else { $msgBody = ereg_replace("\n","<br>",$dataTxt); $msgBody = ereg_replace("\n","<br>",$dataTxt); $msgBody = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i","$1http://$2", $msgBody); $msgBody = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i","<A TARGET=\"_blank\" HREF=\"$1\">$1</A>", $msgBody); $msgBody = preg_replace("/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?))/i","<A HREF=\"mailto:$1\">$1</A>",$msgBody); $mailformat = "text"; } if ($mailformat == "text") { ini_set('default_charset', 'UTF-8'); echo "<html><head><title>Messagebody</title></head><body bgcolor=\"white\">$msgBody</body></html>"; } else { echo $msgBody; } |
|
|
![]() ![]() |
![]() |
Aktualny czas: 24.08.2025 - 19:58 |