note 17019 added to function.imap-headers
| From: | rupert at ditzed dot org | Date: | Thu, 22 Nov 2001 11:40:25 +0000 |
| Subject: | note 17019 added to function.imap-headers | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21155@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);
--
http://www.php.net/manual/en/function.imap-headers.php
http://master.php.net/manage/user-notes.php?action=edit+17019
http://master.php.net/manage/user-notes.php?action=delete+17019
http://master.php.net/manage/user-notes.php?action=reject+17019