PHP imap_open not working


I'm getting an error:

Warning: imap_open() [function.imap-open]: Couldn't open stream {}INBOX in /home/.../imap.php on line 3

when using code:

$mbox = imap_open('{}INBOX', '<user>', '<pass>');



Your URL has pop3 for a sub-domain. Are you sure that IMAP is available (ports 143 or 993 open)?

Doing a quick search, it looks like imap has to be enabled on your account. Are you able to IMAP to the server using a standard mail client, like Thunderbird?

Also, you are pointing to on port 995, which is a POP3 port, not an IMAP port.




In my case it was{domain:110/pop3/novalidate-cert}INBOX that helped me in fixing both the CLOSED IMAP connection broken (server response) and Certificate failure for domain.

Confirm your ports and also whether you have ssl enabled using

openssl s_client -crlf -connect your-domain-name:port-number

People are also looking for solutions to the problem: php - How to get Laravel rows randomly, from filtered rows?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.