我使用下載附件此代碼從Gmail如何使用IMAP和PHP
$savedir = __DIR__ . '/imap-dump/';
$inbox = new IMAPMailbox($hostname, $username, $password);
$emails = $inbox->search('ALL');
if ($emails) {
rsort($emails);
foreach ($emails as $email) {
foreach ($email->getAttachments() as $attachment) {
$savepath = $savedir . $attachment->getFilename();
file_put_contents($savepath, $attachment);
}
}
}
下載郵件附件,但是當我們執行它表明這個錯誤無法連接到Gmail:
Can't connect to gmail-imap.l.google.com,993: Connection refused
如何我可以解決這個問題嗎?`