IMAP Problem2

the mail() function

Moderators: macek, egami, gesf

Post Reply
adly3000
New php-forum User
New php-forum User
Posts: 55
Joined: Thu Apr 08, 2004 4:39 pm
Location: Egypt
Contact:

IMAP Problem2

Post by adly3000 » Sat Feb 11, 2006 6:29 am

i'd like to set or clear the seen flag to any selected message:

Code: Select all

if (isset($_GET['hmark']) && isset($_GET['dmsg']) && isset($_GET['fresh']))
{
	$dmsg = $_GET['dmsg'];
	$flagtype = $_GET['hmark'];
	$fresh = $_GET['fresh'];
	$used = isset($_SESSION['used']) ? $_SESSION['used'] : array();
	if (!isset($used[$fresh]))
	{
		if ($flagtype=='Seen')
		{
			include("functions/flagmsg.php");
			fnflagmsgs($dmsg, $flagtype);
		}
		elseif ($flagtype=='UnSeen')
		{
			list($un, $flagtype) = explode("Un",$flagtype);
			include("functions/unflagmsg.php");
			fnunflagmsgs($dmsg, $flagtype);
		}
		$used[$fresh] = TRUE;
		$_SESSION['used'] = $used;
	}
}
1- 'hmark' is a select in the form whic will pass 'Seen'.
2- 'dmsg' is checkboxes.
3- 'fresh' is a hidden field to prevent repeatation on refreash.
the flagmsg.php contains:

Code: Select all

function fnflagmsgs($flagedmsgs, $flagtypeis)
{
	global $dmsg;
	global $flagtype;
	//-- open imap connection --//
	$mboxflag = @imap_open("{mail.adly3000.trap17.com:143}", "".$_SESSION['SESSION_USER_NAME']."+".$_SESSION['SESSION_MAIL_HOST']."", $_SESSION['SESSION_USER_PASS']) or header("Location: error.php?ec=3");
	//-- delete specified message numbers --//
	for ($x=0; $x<sizeof($flagedmsgs); $x++)
	{
		imap_setflag_full($mboxflag,imap_uid($mboxflag,$flagedmsgs[$x]),'\\\\".$flagtypeis."',ST_UID);
	}
	//-- close imap connection page --//
	imap_close($mboxflag);
}
so it doesnot set or even clear the flags, why i don't know?!
hmmmm.... the greatest is that my view page set the seen flag as desired?! lol
plz plz plz help me!!! :help:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest