note 17019 deleted from function.imap-headers by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 23:48:32 +0000 |
| Subject: | note 17019 deleted from function.imap-headers by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22380@lists.php.net to get a copy of this message | ||
Both of these examples seem a little odd. Rather than trying to add one to your $key, then use that
value, you should only add one whenever you need to. Also, you can't use the header from
imap_header in a scalar context, it only returns the word "Object". See imap_headerinfo
for details.
My version of the above functions is as follows (though I am using this to access POP3, not an IMAP
server).
$mbox = imap_open ("{gate.localnet:110/pop3}INBOX", "test",
"test78") or die ("Could not open mailbox");
$headers = imap_headers ($mbox);
for ($msg_idx = 0; $msg_idx < count ($headers); $msg_idx++)
{
echo "$headers[$msg_idx]: ";
$header = imap_headerinfo ($mbox, ($msg_idx+1));
echo "$header->subject " . $header->from[0]->mailbox . "@" .
$header->from[0]->host . "< BR >\n";
}
imap_close($mbox);