Search code examples
phpemailconnectiongmailblocked

GMail imap connection blocked because the server is in different country


I have a web application developed in PHP that connects to GMail using PHP IMAP extension, this extension is enabled and working correctly. When I try to connect to GMail using IMAP in my application, on my local server it works correctly (I live in Brazil), but when I put the application in production server, located in USA the GMail servers blocks my connection attempt. Other e-mail providers such as Yahoo or Hotmail (Outlook) works fine, this error only occurs with GMail accounts. When I perform local tests, all is fine, when I test it in my production server, I cannot connect and I receive GMail messages talking about the blocked login attempt. I don't know how I solve this, I thought to use a proxy server but this can left the application very slow.

Anyone had the same problem?


Solution

  • Have you visited this URL yet? If not, go there and follow the instructions then try to sign in again with your application on the production server.

    https://accounts.google.com/displayunlockcaptcha