Connecting to Gmail IMAP PHP “Couldn't open stream”

前端 未结 7 1798
别跟我提以往
别跟我提以往 2021-01-11 12:12

There are lots of people having similar issues but no one is answering their questions. I have IMAP enabled in PHP, Using all the correct information. I don\'t see where I\'

7条回答
  •  失恋的感觉
    2021-01-11 12:46

    You can try the following code by giving a notls argument and connecting the server like follows, if SSL is not applied.

    $hostname = '{imap.YOUR_DOMAIN.com:143/imap/notls}INBOX'; 
    $username = 'YOUR_USERNAME';
    $password = 'YOUR_PASSWORD';
    
    $inbox = imap_open($hostname, $username, $password) or die('Cannot connect to Gmail: ' . imap_last_error());
    

    If it will not throw any error, this means that you are succesfully connected to server then. I hope this helps.

提交回复
热议问题