Reputation: 417
I'm using this library for reading mails: https://github.com/barbushin/php-imap
When trying to get all mails from mailbox ($mailsIds = $mailbox->searchMailbox('ALL');
) I got this error:
Caught exception: Connection error: [CLOSED] IMAP connection broken (server response) Notice: Unknown: [CLOSED] IMAP connection broken (server response) (errflg=2) in Unknown on line 0
Mailbox is on Microsoft Exchange Server. P.S. this solution don't help: PHP IMAP Exchange Issue
Upvotes: 2
Views: 9472
Reputation: 9297
As Per Answer Reading mails on server with IMAP?
I had exactly the same problem on my Ubuntu 11.04 system, and I've solved by creating the "Maildir" folders in my home directory (as described here) with the following commands:
cd ~ maildirmake Maildir maildirmake Maildir/.Drafts maildirmake Maildir/.Sent maildirmake Maildir/.Trash maildirmake Maildir/.Templates chmod -R 700 Maildir
First of all, you should check for errors in the log file "/var/log/syslog" (for example by executing the command
sudo tail /var/log/syslog
).
In my log I had noticed the following error:imapd: chdir Maildir: No such file or directory
.
So I've checked the configuration file "/etc/courier/imapd" and I saw that the MAILDIRPATH option was set to "Maildir":# # MAILDIRPATH - directory name of the maildir directory. # MAILDIRPATH=Maildir
Then I've created the "Maildir" folders as described above, and the "imap_open()" function finally worked.
Upvotes: 1