2017-04-04 59 views
1

我使用這個庫讀取郵件:https://github.com/barbushin/php-imapPHP IMAP連接中斷(服務器響應)(ERRFLG = 2)

當試圖從郵箱($mailsIds = $mailbox->searchMailbox('ALL');)的所有郵件,我得到這個錯誤:

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 

郵箱位於Microsoft Exchange Server。 P.S.該解決方案不幫:PHP IMAP Exchange Issue

回答

1

按答案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.

+1

我的腳本是不一樣的服務器上,而我沒有IMAPD,腳本嘗試連接到MS Exchange服務器。 – darjus