Page 1 of 1

[php] Imap_mail_move strange error

Posted: Fri Oct 30, 2009 12:06 pm
by Wolfie
Hey all,

I have this function in my mailbox class :

Code: Select all

 
public function move($mId, $mailbox) {
            $box = '[Google Mail]/'.$mailbox;
            imap_mail_move($this->_connection, "$mId:$mId", $box);
        }
 
then I am calling this function like this :

Code: Select all

 
$conn = new MailboxModel;
$conn->connect('gmail.com','somemail@gmail.com','somepass');
$conn->move(399, 'Spam');
 
In this case everything works just fine

But I am building web mail client MVC pattern based and I am calling this function in one of the controllers :

Code: Select all

 
public function mailbox($params) {
            $this->model->setStr();
            $this->model->connect('gmail.com',$_SESSION['login'],$_SESSION['pass'],'993','imap');
            if(isset($params['msgs_id'])) {
                if($params['message'] == 'Ham') {
                    $spam = 0;
                } elseif($params['message'] == 'Spam') {
                    $spam = 1;
                }
                $idArray = $params['msgs_id'];
                $filter = new Filter;
                foreach($idArray as $id) {
                    echo $id.'<br/>';
                    echo $params['message'];
                    //$text = $this->model->body($id);
                    //$text = $this->model->replace($text);
                    //$filter->setText($text);
                    //$filter->trainFilter($spam);
                    $this->model->move($id, $params['message']);
                }
                //$this->model->expunge();
            }
               //rest of the function.....
 
so I am calling this function like this :

Code: Select all

 
$this->model->move($id, $params['message']);
 
of course $this->model is already an object prepared earlyer in the controller....

And the passed variables are for sure good, I have been checking this couple of times.

So when I am trying to move message over my mvc based mail client I am getting this error :
Notice: Unknown: IMAP protocol error: Could not parse command (errflg=2) in Unknown on line 0

Notice: Unknown: Could not parse command (errflg=2) in Unknown on line 0
And of course imap_mail_move doesn't work.....any ideas folks ? It's very important for me to pass over this issue.....