Reputation: 124758
I'm trying to automatically retrieve some email from my GMail account for further parsing, but I can't get my head around on how to do that. I've searched the internets and it suggested that I use PHP's imap
functions, like this:
$server = '{imap.gmail.com:993/ssl}';
$connection = imap_open($server, '[email protected]', 'password');
But using that code, I get:
Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/ssl}
Any idea what I am doing wrong? Any server setting that might be preventing me from making a connection to GMail (I'm using a shared service)? Is the address even right? Has anyone ever managed to do something like this? I've found tons of examples on how to send email via GMail, but very little of retrieving.
Any help is much appreciated.
Upvotes: 2
Views: 2012
Reputation: 124758
The problem was with my host's configuration, apparently outgoing connections to port 993 were prevented.
Upvotes: 0
Reputation: 165193
That worked fine for me (Your exact code, with my u/p). Are you sure you have IMAP turned on in your GMail account (In your account settings)? I used 5.3.2 on Linux (CentOS)...
Upvotes: 1