Login   Register  
PHP Classes
elePHPant
Icontem

Fix for select_mailbox()

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      IMAP  >  All threads  >  Fix for select_mailbox()  >  (Un) Subscribe thread alerts  
Subject:Fix for select_mailbox()
Summary:A small fix for select_mailbox() and examin_mailbox()
Messages:2
Author:Anders Jenbo
Date:2010-01-06 22:04:33
Update:2012-03-30 07:56:38
 

  1. Fix for select_mailbox()   Reply  
Picture of Anders Jenbo
Anders Jenbo
2010-01-06 22:04:34
This fixes the functions for mailboxes with spaces in the name.


/* The select_mailbox command selects a mailbox so that messages in the
mailbox can be accessed. */
function select_mailbox($mailbox_name)
{
if($this->state=="AUTHORIZATION")
{
$this->error= "Error : User is not authorised or logged in.!<br>";
return false;
}
if($this->put_line($this->tag.' SELECT "'.$mailbox_name.'"'))
{
$response=$this->get_server_responce();
if(substr($response,strpos($response,$this->tag.' ')+strlen($this->tag)+1,2)!="OK")
{
$this->error= "Error : $response !<br>";
return false;
}
}
else
{
$this->error= "Error : Could not send User request. <br>";
return false;
}
$this->state="SELECTED";
return $response;
}
/* The examin_mailbox command is identical to SELECT and returns the same
output; however, the EXAMINE is identified as read-only.*/
function examin_mailbox($mailbox_name)
{
if($this->state=="AUTHORIZATION")
{
$this->error= "Error : User is not authorised or logged in.!<br>";
return false;
}
if($this->put_line($this->tag.' EXAMINE "'.$mailbox_name.'"'))
{
$response=$this->get_server_responce();
if(substr($response,strpos($response,$this->tag." ")+strlen($this->tag)+1,2)!="OK")
{
$this->error= "Error : $response !<br>";
return false;
}
}
else
{
$this->error= "Error : Could not send User request. <br>";
return false;
}
$this->state="SELECTED";
return $response;
}

  2. Re: Fix for select_mailbox()   Reply  
Picture of Anders Jenbo
Anders Jenbo
2012-03-30 07:56:39 - In reply to message 1 from Anders Jenbo
This is fixed in my rewrite of the class at https://github.com/AJenbo/PHP-imap