imap_fetch_overview [SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dwessell
Forum Commoner
Posts: 62
Joined: Fri Dec 23, 2005 2:30 pm

imap_fetch_overview [SOLVED]

Post by dwessell »

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hey gang..

Ok... Moving forward 

I have a POP3 account that I'm trying to write some scripts for.. There's one message only in the account... I'm able to connect to the account just fine..

Using the code snippet below (Mostly from php.net)... I cannot get $val,$subj, or $val->subject to echo a value.. I'm assuming that it means nothing is being assigned.

$message works perfectly, so I'm taking that to mean that the message number is correct, since all the values are using $i to work through the mailbox.. Any thoghts would be welcome as always.

Thanks
david

Code: Select all

$MC=imap_check($mbox);
$MN=$MC->Nmsgs;
$overview=imap_fetch_overview($mbox,"1:$MN",0); 


$size=sizeof($overview);
for($i=1;$i<($size+1);$i++){
	$val=$overview[$i];
	$subj=$val->subject; 
	$message = imap_body($mbox,$i);
	echo "$val->subject   $message";
}

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Last edited by dwessell on Fri Jan 06, 2006 6:47 am, edited 1 time in total.
dwessell
Forum Commoner
Posts: 62
Joined: Fri Dec 23, 2005 2:30 pm

Post by dwessell »

Solved ;)

The array that is returned begins at 0, the message UID's begin at 1..

Code: Select all

for($i=0;$i<$size;$i++){
	$val=$overview[$i];
	$subj=substr($val->subject,11); 
	$message = imap_body($mbox,$i+1);
	echo "$subj   $message";
}
Post Reply