Solved

Problems Changing Flags of POP3 Email with PHP

Posted on 2002-06-27
2
1,078 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:Richard Quadling
ID: 7116009
Try  ...
imap_setflag_full($mailbox,imap_uid($mailbox,$iMessageNo),"\\SEEN",ST_UID);

Richard.
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 200 total points
ID: 7116019
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

810 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