Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Imap Status Set Flags Problem, IMAP status set flags problem
adly3000
post Feb 11 2006, 02:35 PM
Post #1


Member [Level 1]
****

Group: Members
Posts: 58
Joined: 31-January 06
Member No.: 17,937



i'd like to set or clear the seen flag to any selected message:
CODE
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

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:
Go to the top of the page
 
+Quote Post
adly3000
post Feb 17 2006, 05:50 PM
Post #2


Member [Level 1]
****

Group: Members
Posts: 58
Joined: 31-January 06
Member No.: 17,937



i solved the problem and here's the code:
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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Imap Problem(1)
  2. Script That Tracks The User Status(4)
  3. Php And Imap To Read Emails - Need Help(0)
  4. Reading Emails Using Php (imap)(0)


 



- Lo-Fi Version Time is now: 12th October 2008 - 05:29 PM