Solved

Problems Changing Flags of POP3 Email with PHP

Posted on 2002-06-27
2
1,106 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 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