开发者

PHP email to IMAP account

开发者 https://www.devze.com 2023-01-29 21:03 出处:网络
I\'m using PHPmailer to send an email from a website to the website owner. It works fine to some addresses (e.g. my Gmail account), and it used to work to the owner\'s address, but he\'s recently chan

I'm using PHPmailer to send an email from a website to the website owner. It works fine to some addresses (e.g. my Gmail account), and it used to work to the owner's address, but he's recently changed from POP to IMAP and now he doesn't receive emails from the website. He does receive emails from other sources. This is the code:

    $mail = new PHPMailer(true);    

    try {  
          $mail->AddAddress($to, 'Example To');
          $mail->SetFrom('example@example.com', 'Example');
          $mail->AddReplyTo('example@example.com', 'Example');
          $mail->Subject = $subject;
 开发者_C百科         $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
          $mail->MsgHTML($message);
          $mail->Send();
          //echo "Message Sent OK</p>\n";
        } catch (phpmailerException $e) {
          echo $e->errorMessage(); //Pretty error messages from PHPMailer
        } catch (Exception $e) {
          echo $e->getMessage(); //Boring error messages from anything else!
        }

Any advice much appreciated. Thanks! G


That has nothing to do with the PHP code. The IMAP protocol is just responsible for fetching the mails from the server as a user (with IMAP the mails stay on server ... you have an open stream for a long time ...).
So: did he switch to another email provider? Maybe it is in spam. Check the maillog! ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号