Jump to content
xisto Community
Sign in to follow this  
adly3000

Imap Status Set Flags Problem IMAP status set flags problem

Recommended Posts

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

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:

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:

Share this post


Link to post
Share on other sites

i solved the problem and here's the code:

<?function fn_flagmsgs($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");	//-- set flags for the specified message numbers --//	reset($flagedmsgs);	while (list($key, $val) = each($flagedmsgs))	{		$flagedmsgs2[$key] = imap_uid($mboxflag, $val);	}	switch ($flagtypeis)	{		case "Seen":			imap_setflag_full($mboxflag, implode(',', $flagedmsgs2), '\\Seen', ST_UID);			break;		case "Unseen":			imap_clearflag_full($mboxflag, implode(',', $flagedmsgs2), '\\Seen', ST_UID);			break;	}	//-- close imap connection page --//	imap_close($mboxflag);}?>

the i call that function to set any flag.

Share this post


Link to post
Share on other sites

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:


 

Can you share the script to set the flag? because there is no working script on the internet!!! (including PHP.net) ... and i really can make it work.

 

I will thank you a lot!!!

Edited by freshbytes (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.