Solved

Problems Changing Flags of POP3 Email with PHP

Posted on 2002-06-27
2
1,083 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

856 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