Making imap_headers readable so I can link to a message ID?
Posted: Fri Jul 25, 2008 11:21 am
I can't seem to figure out why when I try to display an individual message by the email's ID that I get a bad message number. Now below I create anchors to the message to read (the $_GET['read'] is the message id I get from the headers) but again it's telling me bad message numbers. I guess 1,2,3,4 aren't valid message numbers? This is all directly through IMAP, no DBs or anything. This one tiny thing is what I'm kind of stumped on and I'm doing pretty good with everything else right now (well I think at least heh). Help please!
List Page
Individual Message Page
List Page
Code: Select all
if (!isset($_GET['read']))
{
$mail = 'user_at_domain.com'; /* obviously a working email is used but this code will appear on a client so I'm not going to give spam bots more targets to shot at */
$pass = 'pass_here';
$mbox = imap_open("{mail.jabcreations.com:143/notls}", $mail, $pass);
$headers=imap_headers($mbox);
for($x=1; $x < count($headers); $x++)
{
$idx=($x-1);
echo '<div><a href="list.php?read='.$x.'">'.$headers[$idx].'</a></div>'."\n";
}
imap_close($mbox);
}Code: Select all
else if (isset($_GET['read']))
{
$mail = 'user_at_domain.com'; /* obviously a working email is used but this code will appear on a client so I'm not going to give spam bots more targets to shot at */
$pass = 'pass_here';
$mbox = imap_open("{mail.jabcreations.com:143/notls}", $mail, $pass);
$id = $_GET['read'];
$header=imap_header($mbox, $id);
/* The $header part is where I get the bad message ID from the $_GET['read']. */