Help with IMAP & date, Date, udate, MailDate
| From: | David Christensen | Date: | Sat, 24 Aug 2002 14:52:19 +0000 |
| Subject: | Help with IMAP & date, Date, udate, MailDate | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-113940@lists.php.net to get a copy of this message | ||
I posted this once before, but no one responded... try 2!
I'm trying to retrieve a list of headers from a Courier IMAP server to
display in a table. For some reason the date fields are not consistent
and the udate and MailDate are not correct. Here's an example of output
with different date fields (Index, Size, udate, date, Date, MailDate):
0 2365 1023729291 Fri, 5 Apr 2002 08:30:42 -0800 Fri, 5 Apr 2002 08:30:42 -0800 10-Jun-2002
10:14:51 -0700
1 1611 1023729291 14 Apr 2002 23:33:02 -0000 14 Apr 2002 23:33:02 -0000 10-Jun-2002
10:14:51 -0700
2 2582 1023729291 Wed, 17 Apr 2002 11:55:26 -0500 Wed, 17 Apr 2002 11:55:26 -0500 10-Jun-2002
10:14:51 -0700
Here's the code:
$mbox = imap_open("{localhost:143}",$user,$pass)
or die("can't connect: ".imap_last_error());
for($idx=1; $idx <= 3; $idx++)
{
$msg_header = imap_header($mbox,$idx);
strip_tags($msg_header->udate));
print "<tr>\n";
print "<td>" . $idx . "</td>\n";
print "<td align=right>" . $msg_header->Size . "</td>\n";
print "<td>" . $msg_header->udate . "</td>\n";
print "<td>" . $msg_header->date . "</td>\n";
print "<td>" . $msg_header->Date . "</td>\n";
print "<td>" . $msg_header->MailDate . "</td>\n";
print "</tr>\n";
}