tags:

views:

67

answers:

2

Hi,

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.

+1  A: 

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)...

ircmaxell
A: 

The problem was with my host's configuration, apparently outgoing connections to port 993 were prevented.

Tatu Ulmanen