CakeFest 2024: The Official CakePHP Conference

mailparse_msg_extract_part_file

(PECL mailparse >= 0.9.0)

mailparse_msg_extract_part_fileИзвлечь/декодировать секцию с сообщением из файла

Описание

mailparse_msg_extract_part_file(resource $mimemail, mixed $filename, callable $callbackfunc = ?): string

Извлечь/декодировать секцию с сообщением из указанного файла.

Контент сообщения будет декодирован в соответствии с кодировкой пересылки. Поддерживаются следующие кодировки: base64, quoted-printable и uuencoded.

Список параметров

mimemail

Корректный MIME-ресурс, созданный mailparse_msg_create().

filename

Имя файла или корректный потоковый ресурс.

callbackfunc

Если задано, то в эту функцию будет передано извлечённое сообщение. Если null, то извлечённое сообщение будет просто возвращено.

Если не задано, то контент будет направлен на стандартный вывод (stdout).

Возвращаемые значения

Если callbackfunc не null, то вернёт true в случае успешного выполнения.

Если callbackfunc задана как null, вернёт извлечённую секцию сообщения в виде строки.

Вернёт false в случае возникновения ошибки.

Смотрите также

add a note

User Contributed Notes 2 notes

up
1
per at computer dot org
19 years ago
mailparse_msg_extract_part_file() does not support file-wrappers as it needs to be able to use seek() on the file.
up
-3
carlos at wfmh dot org dot pl
15 years ago
Be aware of "corporate mails" or users who do not understand character encoding too deeply (or do not care). You may (as we did) face mail where the whole mail body is encoded used i.e. Latin2 (and iso-8859-2 is given in multipart's charset header) but at the same time the body also contains text footer with UTF-8 characters in it... Yes, fu*g Microsoft Exchange V6.5 frontent will show that fine on the screen, but if when receive it:

mailparse_msg_extract_part_file() - filter conversion failed. Input message is probably incorrectly encoded in ....

so be extra careful and deal with all the possible errors to avoid mail loss.
To Top