Solved

Problems Changing Flags of POP3 Email with PHP

Posted on 2002-06-27
2
1,058 Views
Last Modified: 2008-03-17
OK...
Per an earlier post I actually ended up figuring out what I was getting in terms on what the current status was on emails.
Now, the next step is to modify the flag/status of the email when several actions are performed:
Read/Opened
Deleted
Responded to
etc..etc..

I have tried map-setflag-full but it hasnt worked..  heres what ive done so far..
$server, $port $mailbox, $user, and $pass are session variables set at login time...

$mbox = @imap_open("{".$server.":".$port."}".$mailbox, $user, $pass) or require_once("login.php");
//!!!  Now inside a function with $mailbox = $mbox and the message number passed as an integer $iMessageNo  {
//Get message code here blah blah

$status = imap_setflag_full ($mailbox, $iMessageNo, "\\Seen", ST_UID)or die(imap_last_error());
print gettype($status)."<br />\n";
print $status."<br />\n";

} //!!!  exit function
//the two print statements return the following:
boolean
1


imap_close($mbox);
///====END read_email.php====
///====back to inbox.php=====
$mbox = @imap_open("{".$server.":".$port."}".$mailbox, $user, $pass) or require_once("login.php");
//draw inbox message headers...  and dernit!!  the flags still arent changed!!

What am I doing wrong?!

0
Comment
Question by:Figment060799
  • 2
2 Comments
 
LVL 40

Expert Comment

by:RQuadling
Comment Utility
Try  ...
imap_setflag_full($mailbox,imap_uid($mailbox,$iMessageNo),"\\SEEN",ST_UID);

Richard.
0
 
LVL 40

Accepted Solution

by:
RQuadling earned 200 total points
Comment Utility
If you try setting the flag, close the mailbox, reopen it and then check. Does the flag only come into view when the mailbox is closed?

The user notes on the PHP manual says that rfc for POP3 says that only the delete flag needs to be supported by POP3. The rest seem to be optional.

You may be finding that your POP3 server does not support these flags!


http://www.php.net/manual/en/function.imap-setflag-full.php

According to the rfc, pop3 does not have support for these flags, except
perhaps for the deleted flag. I haven't tried if the delete flag works on
pop3 or not.



Richard.

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now