Okay, this code \'was\' working perfectly and then I started playing around with it in order to let others connect to their e-mails and as you do ran into a few open stream
resource imap_open(
string $mailbox ,
string $username ,
string $password [,
int $options = 0 [,
int $n_retries = 0 [,
array $params = NULL ]]]
)
Please use the below code to connect successfully,
$hostname = "{imap.gmail.com:993/imap/ssl/novalidate-cert}";
$mailbox = imap_open($hostname, 'admin@artisancodesmith.com', 'PASSWORD');
if ($mailbox)
{
// do work....
}
I have tried this an works perfectly fine for me
$inbox = imap_open("{imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox", 'username', 'password')
or die('Cannot connect to Gmail: ' . imap_last_error());
$emails = imap_search($inbox,'All');
if($emails) {
/* begin output var */
$output = '';
/* put the newest emails on top */
rsort($emails);
/* for every email... */
foreach($emails as $email_number) {
/* get information specific to this email */
$overview = imap_fetch_overview($inbox,$email_number,0);
$message = imap_fetchbody($inbox,$email_number,2);
$header = imap_header($inbox, $email_number);
echo "<h1>data</h1>";
echo "<pre>";print_r($message);
echo "<h1>Message</h1>";
echo "<pre>";print_r($message);
echo "<h1>header</h1>";
echo "<pre>";print_r($message);
$overview[0]->seen;
$overview[0]->subject;
$overview[0]->from;
$overview[0]->date;
}
}
/* close the connection */
imap_close($inbox);
I ran into this problem and here is how I solved it;
after this, above code works for me....
maybe are you behind a proxy? if so, I guess you need to auth against it...