Connecting to Gmail through IMAP with PHP - SSL context failed

前端 未结 10 1901
野的像风
野的像风 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:22

    I was facing same problem. I am using windows and wamp and my wamp "openSSl" extension is enabled.

    I removed this issue by using following steps.I hope this will work for you too.

    1) Logged in via browser to gmail account.

    2) Open this url "https://www.google.com/settings/security/lesssecureapps"

    3) Click at "turn on"

    4) try following code

    subject.'
    '; $output .= $headerInfo->toaddress.'
    '; $output .= $headerInfo->date.'
    '; $output .= $headerInfo->fromaddress.'
    '; $output .= $headerInfo->reply_toaddress.'
    '; $emailStructure = imap_fetchstructure($inbox,$mail); //var_dump($emailStructure->parts); if(isset($emailStructure->parts)) { $output .= imap_body($inbox, $mail, FT_PEEK); } else { // } echo $output; $output = ''; } // colse the connection imap_expunge($inbox); imap_close($inbox); ?>

    BEST OF LUCK. :)

提交回复
热议问题