I'm trying to read only new mail from a mailbox and display it in a table.
What I'm doing is this (server data obfuscated):
$mail=imap_open ('{SERVER}', 'ACC', 'PW');
if($mail){
$headers=imap_h eaders($mail);
// Get number of mail
$current=imap_n um_msg($mail);
// Get content of mails retrieved, formated and presented
$header=imap_he ader($mail,$cur rent);
for($i = 1; $i <= $current; $i++){
$header=imap_he ader($mail,$i);
$recent=$header->Recent;
$unseen=$header->Unseen;
if($recent == "N" || $unseen == "U"){
process mail in various ways
[snipped]
As I understand it (php.net on imap_headers) the if($recent == etc) method
is the way to get only new mail and ignore the rest. But I still get all
mail every time I open the mailbox.
Am I doing something wrong or is our slightly non-standard mail server
misbehaving?
Rgds,
Martin S
What I'm doing is this (server data obfuscated):
$mail=imap_open ('{SERVER}', 'ACC', 'PW');
if($mail){
$headers=imap_h eaders($mail);
// Get number of mail
$current=imap_n um_msg($mail);
// Get content of mails retrieved, formated and presented
$header=imap_he ader($mail,$cur rent);
for($i = 1; $i <= $current; $i++){
$header=imap_he ader($mail,$i);
$recent=$header->Recent;
$unseen=$header->Unseen;
if($recent == "N" || $unseen == "U"){
process mail in various ways
[snipped]
As I understand it (php.net on imap_headers) the if($recent == etc) method
is the way to get only new mail and ignore the rest. But I still get all
mail every time I open the mailbox.
Am I doing something wrong or is our slightly non-standard mail server
misbehaving?
Rgds,
Martin S