Connecting to Gmail through IMAP with PHP - SSL context failed

前端 未结 10 1900
野的像风
野的像风 2020-12-13 14:37

I\'m trying to connect to Gmail through IMAP with PHP running in Apache. This is on an Ubuntu 9.04 system. I\'ve got some sort of PHP configuration issue that is keeping t

10条回答
  •  攒了一身酷
    2020-12-13 15:18

    1. First, enable less secure apps in your Gmail account: https://myaccount.google.com/lesssecureapps

    2. Use this configuration to create IMAP connection:

      $imap_connection = imap_open('{imap.gmail.com:993/imap/ssl/novalidate-
      cert}INBOX', 'YOUR GMAIL USER', 'YOUR GMAIL PASSWORD');
      

    Note: INBOX is your main imbox, for example you can acces to sent items with: INBOX.Sent in your connection.

提交回复
热议问题