IMAP ERROR - Couldn't open stream

MarthaJ Sayers
MarthaJ Sayers used Ask the Experts™
Hi Folks,

    I am getting preeeetty frustrated here.  I have a php page in which I need to connect to a email account and pull all the emails. I am using localhost to create this page. (Windows 64 pro - php 5.6.25 - Apache -2.4.23 - WampServer)
The mail server is hosted at HostGator.

The error msg:

Warning: imap_open(): Couldn't open stream {}INBOX in C:\wamp\www\AcademyEmails\mytest.php on line 24


Cannot connect to Gmail:TLS/SSL failure for Invalid token, probably not an SSL server

We are - for testing - using non-ssl setting. And I know the port is correct, the username, password etc is correct.
Below is the line of coding - I starred out the actual server/user/pwd for posting.

$inbox = imap_open('{imap.***.com:143/debug/imap/ssl/novalidate-cert}INBOX','**********','********') or die('Cannot connect:' . imap_last_error());

Open in new window

Any help apperciated - pretty urgent for me....
thank you
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It appears that you're attempting to use SSL with the imap connection

Try changing :143 to :993 and see how that works for you


Thank you for reponding. Here is what I found out. I need to use 'mail' in my imap_open(blah blah) command instead of imap !!
I can retreive everything except for the body of the message...but we will see...
Do I reward you points etc ?? You took the time to try to help...pls let me know...
Don't worry about it, that's what we're here for :)

If you resolved the question, award yourself the points, This way you save them for when you need them
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Thank you, very kind. I will have more questions no doubt !!


thank you again !
Any time

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial