Voting

: three minus three?
(Example: nine)

The Note You're Voting On

Jille at nomorecrap dot quis dot cx
17 years ago
<?PHP
$headers
=imap_fetchheader($imap, $msgid);
preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $headers, $matches);
?>

Works quite well for splitting headers,
$matches will contain 3 arrays:
$matches[0] are the full-lines (To: [email protected]\r\n)
$matches[1] will be the header (To)
$matches[2] will be the value ([email protected])

In multi-line values the 'multilining is not stripped!'
this could be achieved with something like:
<?PHP
preg_replace
('/\r\n\s+/m', '', $matches[2]);
?>

<< Back to user notes page

To Top