2024 年日本 PHP 研討會

mailparse_msg_get_part

(PECL mailparse >= 0.9.0)

mailparse_msg_get_part傳回 mime 訊息中指定區段的控制代碼

說明

mailparse_msg_get_part(資源 $mimemail, 字串 $mimesection): 資源
警告

此函數目前沒有說明文件;僅提供其參數列表。

參數

mimemail

一個有效的 MIME 資源。

mimesection

新增筆記

使用者貢獻的筆記 1 則筆記

3
vangelier at hotmail dot com
8 年前
一封多部分的電子郵件訊息可以由不同的部分組成。

例如

陣列
(
[0] => 1
[1] => 1.1
[2] => 1.1.1
[3] => 1.1.2
[4] => 1.2
)

每個部分都是郵件訊息中的一個區段。要迴圈處理訊息的每個部分,您需要這樣做

$mime_part = mailparse_msg_get_part($this->message, "1.2"); //1.2 是附件的二進位 base64 編碼部分

$body_parts = mailparse_msg_get_part_data($mime_part);

主體部分如下所示

陣列
(
[headers] => 陣列
(
[content-type] => application/x-zip-compressed; name="3000_000000.txt"
[content-disposition] => attachment; filename="3000_000000.txt"
[content-transfer-encoding] => base64
[x-attachment-id] => b31f1a24358e7e5_0.1
)

[starting-pos] => 4513
[starting-pos-body] => 4736
[ending-pos] => 4772
[ending-pos-body] => 4772
[line-count] => 6
[body-line-count] => 0
[charset] => us-ascii
[transfer-encoding] => base64
[content-name] => 3000_000000.sbd
[content-type] => application/x-zip-compressed
[disposition-filename] => 3000_000000.sbd
[content-disposition] => attachment
[content-base] => /
)
To Top