note 27385 deleted from function.imap-headerinfo by didou
| From: | didou@php.net | Date: | Sun, 14 Jan 2007 23:20:46 +0000 |
| Subject: | note 27385 deleted from function.imap-headerinfo by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121654@lists.php.net to get a copy of this message | ||
Note Submitter: jamie at coverallcrew dot com
----
I was unable to get the message subject by calling imap_headerinfo AFTER calling imap_body. I
flipped them (which makes more sense anyway in our usual understanding of e-mail messages) and it
worked!
// so this code doesn't work:
//------------------------------------------------
for ($i = 1; $i <= imap_num_msg($mbox); $i++)
{
$messageBody = imap_body($mbox, $i);
$header = imap_headerinfo($mbox, $i, 80, 80);
$subject= $header->fetchsubject;
}
imap_close($mbox);
//------------------------------------------------
// but this code does:
//------------------------------------------------
for ($i = 1; $i <= imap_num_msg($mbox); $i++)
{
$header = imap_headerinfo($mbox, $i, 80, 80);
$subject= $header->fetchsubject;
$messageBody = imap_body($mbox, $i);
}
imap_close($mbox);
//------------------------------------------------
Hope this saves some headaches! Jamie