gpt4 book ai didi

php - 使用 imap 通过 php 打开电子邮件给我这个错误 Message : imap_open() [function. imap-open] : Couldn't open stream {imap. gmail.com:993/imap/ssl}INBOX

转载 作者:行者123 更新时间:2023-11-28 09:30:39 25 4
gpt4 key购买 nike

我正在尝试使用 imap 方法通过 php 打开电子邮件,但它给我一个错误无法打开流 {imap.gmail.com:993/imap/ssl}INBOX,这是我的代码

$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'nohamedtemraz92@gmail.com';
$password = '0129799169mohamed';

/* try to connect */
$inbox = imap_open($hostname,$username ,$password) or die('Cannot connect to Gmail: ' imap_last_error());

/* grab emails */
$emails = imap_search($inbox,'ALL');

/* if emails are returned, cycle through each... */
if($emails) {

/* begin output var */
$output = '';

/* put the newest emails on top */
rsort($emails);

/* for every email... */
foreach($emails as $email_number) {

/* get information specific to this email */
$overview = imap_fetch_overview($inbox,$email_number,0);


$output.= 'Name: '.$overview[0]->from.'</br>';
$output.= 'Email: '.$overview[0]->message_id.'</br>';



}

echo $output;
}

/* close the connection */
imap_close($inbox);

最佳答案

试试这个:

$hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$inbox = imap_open($hostname,$username ,$password) or die('Cannot connect to Gmail: ' imap_last_error());

关于php - 使用 imap 通过 php 打开电子邮件给我这个错误 Message : imap_open() [function. imap-open] : Couldn't open stream {imap. gmail.com:993/imap/ssl}INBOX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25723068/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com