2
votes

I moved from Netfirms to AWS. This code worked on Netfirms, but I get this error running on AWS:

Can not authenticate to IMAP server: [ALERT] - Can't connect to '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX': 1.

$connect_to = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$user = '[email protected]';
$password = 'mypassword';

$mbox = imap_open($connect_to, $user, $password) 
    or die("Can't connect to '$connect_to': " . print_r(imap_errors()));
1
Thanks. I had read that one. I just says rebuilt php and openssl and the problem when away. No real reason or solution to the issue. - Haymps
@StevenV that question you linked is completely different... - Sammitch
Have you verified that port 993 is even available on that host? That is, it's quite possible Amazon (or your image) has firewalled it. - Max
@max thanks. I did login and I cleared the messages, but still couldn't read them. AWS support gave me the solution. I clicked the link (accounts.google.com/DisplayUnlockCaptcha) from my PC. It replied that my account was unlocked. Then when I tried the program again from AWS instance, it worked and now I can read gmail emails. This had to be locked from the beginning, but I don't know how my other servers (Netfirms and my PC) were able to read, but not AWS. One person guessed, because it was a new IP address that gmail blocked it right out of the gate. - Haymps

1 Answers

4
votes

This fixes it...

I clicked the link (accounts.google.com/DisplayUnlockCaptcha) from my PC. It replied that my account was unlocked. Then when I tried the program again from AWS instance, it worked and now I can read gmail emails. This had to be locked from the beginning, but I don't know how my other servers (Netfirms and my PC) were able to read, but not AWS. One person guessed, because it was a new IP address that gmail blocked it right out of the gate.