首頁 後端開發 php教程 最好的邮件编码解码类,再没有比这个好的了贴不下了1_PHP教程

最好的邮件编码解码类,再没有比这个好的了贴不下了1_PHP教程

Jul 13, 2016 pm 05:27 PM
decode else 類別 編碼 解碼 這個 郵件

class mime_decode { var $content = Array(); function mime_encode_headers($string) { if($string == "") return; if(!eregi("^([[:print:]]*)$",$string)) $string = "=?ISO-8859-1?Q?".str_replace("+","_",str_replace("%","=",urlencode($string)))."?="; return $string; } function decode_mime_string($string) { if(($pos = strpos($string,"=?")) === false) return $string; while(!($pos === false)) { $newresult .= substr($string,0,$pos); $string = substr($string,$pos+2,strlen($string)); $intpos = strpos($string,"?"); $charset = substr($string,0,$intpos); $enctype = strtolower(substr($string,$intpos+1,1)); $string = substr($string,$intpos+3,strlen($string)); $endpos = strpos($string,"?="); $mystring = substr($string,0,$endpos); $string = substr($string,$endpos+2,strlen($string)); if($enctype == "q") { $mystring = str_replace("_"," ",$mystring); $mystring = $this->decode_qp($mystring); } else if ($enctype == "b") $mystring = base64_decode($mystring); $newresult .= $mystring; $pos = strpos($string,"=?"); } return $newresult.$string; } function decode_header($header) { $headers = explode(" ",$header); $decodedheaders = Array(); for($i=0;$i"; $closed = 1; for($i=0;$i", $thisPart, $regs)) { $email = trim($regs[2]); $name = trim($regs[1]); } else { if (eregi("([-a-z0-9_$+.]+@[-a-z0-9_.]+[-a-z0-9_]+)((.*))", $thisPart, $regs)) { $email = $regs[1]; $name = $regs[2]; } else $email = $thisPart; } $email = eregi_replace("^$", "\1", $email); $name = eregi_replace("^"(.*)"$", "\1", trim($name)); $name = eregi_replace("^((.*))$", "\1", $name); if ($name == "") $name = $email; if ($email == "") $email = $name; $ARfrom[$i]["name"] = $this->decode_mime_string($name); $ARfrom[$i]["mail"] = $email; unset($name);unset($email); } } return $ARfrom; } function build_alternative_body($ctype,$body) { global $mime_show_html; $boundary = $this->get_boundary($ctype); $part = $this->split_parts($boundary,$body); $thispart = ($mime_show_html)?$part[1]:$part[0]; $email = $this->fetch_structure($thispart); $header = $email["header"]; $body = $email["body"]; $headers = $this->decode_header($header); $body = $this->compile_body($body,$headers["content-transfer-encoding"]); return $body; } function build_related_body($ctype,$body) { global $mime_show_html,$sid,$lid,$ix,$folder; $Rtype = trim(substr($ctype,strpos($ctype,"type=")+5,strlen($ctype))); if(strpos($Rtype,";") != 0) $Rtype = substr($Rtype,0,strpos($Rtype,";")); if(substr($Rtype,0,1) == """ && substr($Rtype,-1) == """) $Rtype = substr($Rtype,1,strlen($Rtype)-2); $boundary = $this->get_boundary($ctype); $part = $this->split_parts($boundary,$body); for($i=0;$ifetch_structure($part[$i]); $header = $email["header"]; $body = $email["body"]; $headers = $this->decode_header($header); $ctype = $headers["content-type"]; $cid = $headers["content-id"]; $Actype = split(";",$headers["content-type"]); $types = split("/",$Actype[0]); $rctype = strtolower($Actype[0]); if($rctype == "multipart/alternative") $msgbody = $this->build_alternative_body($ctype,$body); elseif($rctype == "text/plain" && strpos($headers["content-disposition"],"name") === false) { $body = $this->compile_body($body,$headers["content-transfer-encoding"]); $msgbody = $this->build_text_body($body); } elseif($rctype == "text/html" && strpos($headers["content-disposition"],"name") === false) { $body = $this->compile_body($body,$headers["content-transfer-encoding"]); if(!$mime_show_html) $body = $this->build_text_body(strip_tags($body)); $msgbody = $body; } else { $thisattach = $this->build_attach($header,$body,$boundary,$i); if($cid != "") { if(substr($cid,0,1) == "") $cid = substr($cid,1,strlen($cid)-2); $cid = "cid:$cid"; $thisfile = "download.php?sid=$sid&lid=$lid&folder=".urlencode($folder)."&ix=".$ix."&bound=".base64_encode($thisattach["boundary"])."&part=".$thisattach["part"]."&filename=".urlencode($thisattach["name"]); $msgbody = str_replace($cid,$thisfile,$msgbody); } } } return $msgbody; } function linesize($message="", $length=70) { $line = explode(" ",$message); unset($message); for ($i=0 ;$i $length and $buf_o != "") { $message .= "$buf_o "; $buf = $line_part[$e]; } } $message .= "$buf "; } return($message); }

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/531863.htmlTechArticledecode_qp($mystring); } else if ($enctype == b) $mystring = base64_decode($mystring); $newresult .= $mystring; $pos = strpos($string,=?); } return $newresult.$string; } function de...
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1670
14
CakePHP 教程
1428
52
Laravel 教程
1329
25
PHP教程
1274
29
C# 教程
1256
24
Outlook郵件遺失從控制台在Windows 11 Outlook郵件遺失從控制台在Windows 11 Feb 29, 2024 pm 03:16 PM

Windows11的控制台中是否缺少Outlook郵件圖示?這一意外情況在一些依賴OutlookMail滿足通訊需求的個人中引起了困惑和擔憂。為什麼我的Outlook電子郵件沒有顯示在控制台中?控制台中沒有Outlook郵件圖示可能有幾個可能的原因:Outlook未正確安裝。從MicrosoftStore安裝Office應用程式不會將郵件小程式新增至控制台。 mlcfg32.cpl檔案在控制面板中的位置遺失。登錄中的mlcfg32.cpl檔案路徑不正確。作業系統目前未配置為運行此應用程式

Word郵件合併列印空白頁 Word郵件合併列印空白頁 Feb 19, 2024 pm 04:51 PM

如果您發現在使用Word列印郵件合併文件時出現空白頁,這篇文章將對您有所幫助。郵件合併是一項便捷的功能,讓您能夠輕鬆建立個人化文件並傳送給多個收件者。在MicrosoftWord中,郵件合併功能備受推崇,因為它能夠幫助使用者節省手動為每個收件者複製相同內容的時間。為了列印郵件合併文檔,您可以轉到郵件標籤。但有些Word使用者反映,在嘗試列印郵件合併文件時,印表機會列印空白頁或完全不列印。這可能是由於格式設定不正確或印表機設定問題。嘗試檢查文檔和印表機設置,確保列印前預覽文檔,以確保內容正確。如果

知識圖譜:大模型的理想搭檔 知識圖譜:大模型的理想搭檔 Jan 29, 2024 am 09:21 AM

大型語言模式(LLM)具有產生流暢和連貫文字的能力,為人工智慧的對話、創意寫作等領域帶來了新的前景。然而,LLM也存在一些關鍵限制。首先,它們的知識僅限於從訓​​練資料中辨識出的模式,缺乏對世界的真正理解。其次,推理能力有限,不能進行邏輯推理或從多個資料來源融合事實。面對更複雜、更開放的問題時,LLM的回答可能變得荒謬或矛盾,被稱為「幻覺」。因此,儘管LLM在某些方面非常有用,但在處理複雜問題和真實世界情境時,仍存在一定的限制。為了彌補這些差距,近年來出現了檢索增強生成(RAG)系統,其核心思想是

Oracle DECODE函數的高階用法及技巧分享 Oracle DECODE函數的高階用法及技巧分享 Mar 08, 2024 am 10:30 AM

Oracle資料庫中的DECODE函數是一個非常常用的函數,它可以根據一個表達式的結果值在一組值中進行選擇。 DECODE函數的語法如下:DECODE(expression,search_value1,result1,search_value2,result2,...,default_result)其中,expression是要進行比較的表達式,s

Oracle DECODE函數詳解及用法範例 Oracle DECODE函數詳解及用法範例 Mar 08, 2024 pm 03:51 PM

Oracle中的DECODE函數是一種條件式,常用於在查詢語句中根據不同的條件傳回不同的結果。本文將詳細介紹DECODE函數的語法、用法和範例程式碼。一、DECODE函數語法DECODE(expr,search1,result1[,search2,result2,...,default])expr:要進行比較的表達式或欄位。 search1,

常見的幾種編碼方式 常見的幾種編碼方式 Oct 24, 2023 am 10:09 AM

常見的編碼方式有ASCII編碼、Unicode編碼、UTF-8編碼、UTF-16編碼、GBK編碼等。詳細介紹:1、ASCII編碼是最早的字符編碼標準,使用7位二進制數表示128個字符,包括英文字母、數字、標點符號以及控製字符等;2、Unicode編碼是一種用於表示世界上所有字元的標準編碼方式,它為每個字元分配了一個唯一的數字碼點;3、UTF-8編碼等等。

如何在C語言程式設計中實作中文字元的編碼和解碼? 如何在C語言程式設計中實作中文字元的編碼和解碼? Feb 19, 2024 pm 02:15 PM

在現代電腦程式設計中,C語言是一種非常常用的程式語言之一。儘管C語言本身並不直接支援中文編碼和解碼,但我們可以使用一些技術和函式庫來實現這項功能。本文將介紹如何在C語言程式設計軟體中實作中文編碼和解碼。首先,要實作中文編碼和解碼,我們需要了解中文編碼的基本概念。目前,最常用的中文編碼方案是Unicode編碼。 Unicode編碼為每個字元分配了一個唯一的數字值,以便在計

蘋果 iOS 18 郵件應用程式插上 AI 翅膀:增強搜尋、智慧撰寫 / 回覆、分類摘要等 蘋果 iOS 18 郵件應用程式插上 AI 翅膀:增強搜尋、智慧撰寫 / 回覆、分類摘要等 Jun 11, 2024 pm 09:34 PM

6月7日消息,科技媒體AppleInsider昨天發布博文,曝料蘋果公司內部正研發ProjectBlackPearl項目,主要增強iOS18、macOS15系統中的郵件應用,能讓AI幫用戶撰寫和回复郵件。梳理相關內容如下:增強搜尋ProjectBlackPearl專案首先增強郵件搜尋結果,會顯示來自通訊錄、位置和本機儲存文件的更多資訊。智慧型回覆此外郵件應用程式中新增「智慧回覆」(SmartReplies)功能,會基於本地運行的大語言模型(LLM)Ajax,結合郵件情境情境給予適當的回覆內容。寫郵

See all articles