Imap Status Set Flags Problem - IMAP status set flags problem

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Imap Status Set Flags Problem - IMAP status set flags problem

adly3000
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:

 

 

 


Reply

adly3000
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.

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. imap flag field not show in opera - 181.24 hr back. (5)
  2. imap_setflag_full problem - 1101.37 hr back. (1)
Similar Topics

Keywords : imap status flags imap status flags

  1. Imap Problem - i want to check if the message is not seen (1)
    i'd like to know which message i had not been seen, so i searched the manual and fid 2 flags
    says Unseen == 'U' || Recent == 'N' mean. but i don,t understand what does Unseen ==
    'U' || Recent == 'N' mean(what he mean by flags )? i want to check if the
    message is not seen, so how to do that? i tried CODE $inbox =
    @imap_open("{mail.mysite.com:110/pop3}",
    "".$_SESSION['SESSION_USER_NAME']."+".$_SESSION['S
    ESSION_MAIL_HOST']."", $_SESSION&...
  2. Reading Emails Using Php (imap) - (0)
  3. Php And Imap To Read Emails - Need Help - (0)
    Hi everyone, im experimenting with php and IMAP to read emails on my local email server. My local
    email server is Mercury V4 which aparently does support POP and IMAP, i have confirmed the server is
    working by sending an email from the server using its internal send mail system and then checking
    that email using the Thunderbird client. the email was sent and received properly. So i moved into
    the PHP area and done the basic connect code (the full code i used is below so check that, im sure
    its right, i basically copied it) which seemed to work, i got the result: "Resou...
  4. Script That Tracks The User Status - how can I track on or offline users? (4)
    long explaination: hey, I'm building a user profile site right now. And, I kinda know how to
    make a online/offline detector, but not totally sure. I know I can make a mysql database to track
    them, but how does it entrer the information? I could easily put in a field where when they login it
    sets them to online, but if they don't sign out, and just exit the browser, how can I tell.
    short: I want someone to tell me how to make a online/offline status detector, like they have here
    on trap17. I'd be thrilled if you can post to this, thanks, arcticsnpr...
  5. Trap17 Board Status Dynamic Image - (13)
    I was really board a few days ago and decided to make a trap17 board status image for my sig
    /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> That is the
    current beta. I'm still working on it so that it might display the most recent post or
    somthing, i'm not sure. After I finish it ill give out the source code but if you want one
    right now you can pm me and ill set one up to get the info on your account ^.^ So I was wondering
    how you members liked it? You'll probably think that its a waist of time, but alas as I sai...
  6. Returning Game Status - retrieving game status (11)
    I'm currently making a fansite for a game thats coming out soon and im wondering how I can show
    the game status: Meaning..is the game down? or is the game up? I of course don't have access to
    their servers and I have no IP whatsoever, Im very sure they won't give out much info on their
    servers either, because their current game (GunBound) is getting hacked like crazy, releasing server
    info might cause problems for both me and Softnyx At the moment I have only the forum status (wich
    is pretty easy), and a n/a image on my Game Status. Is there a possibility ...



Looking for imap, status, set, flags, problem, imap, status, set, flags, problem

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for imap, status, set, flags, problem, imap, status, set, flags, problem

*MORE FROM TRAP17.COM*
advertisement



Imap Status Set Flags Problem - IMAP status set flags problem



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE