Zend 1.12和IMAP:创建文件夹失败

时间:2015-09-23 07:33:14

标签: php zend-framework imap

我正在连接到IMAP邮箱并尝试使用PHP和Zend 1.12创建文件夹INBOX / test:

$this->Mail = new Zend_Mail_Storage_Imap(array(
                    'host'      => $this->sHost,
                    'port'      => $this->nPort,
                    'user'      => $this->sUser,
                    'password'  => $this->sPass,
                    'ssl'       => $this->sSsl,
                    'folder'    => 'INBOX')); // Works, I can get all messages in INBOX for example

$allFolders = $this->Mail->getFolders('INBOX'); // Throws  'Zend_Mail_Storage_Exception' with message 'folder not found'

$this->Mail->createFolder('test', 'INBOX'); // Throws 'Zend_Mail_Storage_Exception' with message 'cannot create folder'

$Folder = $this->Mail->getFolders()->INBOX; // Works, so INBOX is there

任何想法可能出错?

1 个答案:

答案 0 :(得分:0)

$allFolders = $this->Mail->getFolders('INBOX.');
$this->Mail->createFolder('INBOX.test');

注意INBOX背后的点,这使它有效。