PHP: Hypertext Preprocessor (original) (raw)
Found A Problem?
rgagnon24 dot nospam at gmail dot com ¶
14 years ago
`Interesting that imap_headerinfo() does not allow a UID for the $msg_number field like all other fetching functions seem to allow.
If you want to use a UID to fetch the headers, use this two-step process:
mboxisyourstream,andmbox is your stream, and mboxisyourstream,anduid is set * properly. Proper error checking is up to you. */ hText=imapfetchbody(hText = imap_fetchbody(hText=imapfetchbody(mbox, $uid, '0', FT_UID); headers=imaprfc822parseheaders(headers = imap_rfc822_parse_headers(headers=imaprfc822parseheaders(hText); ?>The result is the same as the output of imap_headerinfo(), but you get to use the UID.
`
Jille at nomorecrap dot quis dot cx ¶
17 years ago
`headers=imapfetchheader(headers=imap_fetchheader(headers=imapfetchheader(imap, $msgid); preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', headers,headers, headers,matches); ?>
Works quite well for splitting headers,
$matches will contain 3 arrays:
$matches[0] are the full-lines (To: Jille@devnull.quis.cx\r\n)
$matches[1] will be the header (To)
$matches[2] will be the value (Jille@devnull.quis.cx)
In multi-line values the 'multilining is not stripped!'
this could be achieved with something like:
`