Hmm... I just read some user notes and found this:
<?php
// connecting to imap mailserver
$connection = @imap_open("{localhost:143/imap}INBOX", "your_username", "your_password");
// get imap_fetch header and put single lines into array
$header = explode("\n", imap_fetchheader($connection, 1));
// browse array for additional headers
if (is_array($header) && count($header)) {
$head = array();
foreach($header as $line) {
// is line with additional header?
if (eregi("^X-", $line)) {
// separate name and value
eregi("^([^:]*): (.*)", $line, $arg);
$head[$arg[1]] = $arg[2];
}
}
}
// now are all contained additional headers in array $head
?>
Or, better yet, use the [man]imap_headerinfo/man function to do it... so much easier... here's an example:
for($i=1; $i<imap_num_msg($imapconn); $i++)
{
$minfo = imap_fetchheader($imapconn, $i, 80, 80);
$msg[$i]['subject'] = $minfo->fetchsubject;
$msg[$i]['from'] = $minfo->fetchfrom;
$msg[$i]['to'] = $minfo->toaddress;
$msg[$i]['date'] = date('l F j, Y h:i a', $minfo->udate);
}
Perhaps that can help you...
~Brett