I’ve been trying to use PHP to access gmail but I can’t get it to work.
I’m not sure if it’s MAMP PRO’s issue. I’m using MAMP PRO 2.0.3
Here is my code:
$server="{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX";
$inbox = imap_open($server,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
And the error I got was:
PHP Notice: Unknown: Can't open mailbox {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX: invalid remote specification (errflg=2) in Unknown on line 0
After some research, I have found out that MAMP PRO doesn’t have imap-ssl installed and therefore it cannot connect to gmail server since it requires ssl.
Instead, used PHPMailer library.