dongtazu3080 2018-05-24 20:19 采纳率: 100%
浏览 76
已采纳

新的PHPMailer没有运行

Below is the phpmailer code which I am using :

  use PHPMailer\PHPMailer\PHPMailer;
  use PHPMailer\PHPMailer\Exception;
  require '../vendor/autoload.php'; 
   $mail = new PHPMailer(true);  
   try {  
       $mail->SMTPDebug = 2; 
       $mail->isSMTP();  
       $mail->Host = as given in the configure mail client window; 
       $mail->SMTPAuth = true; 
       $mail->Username =as given in the configure mail client window; 
       $mail->Password = as given in the configure mail client window;
       $mail->SMTPSecure = 'tls' ; 
       $mail->Port = 465; 
       $mail->setFrom('my email', 'my name');
       $mail->addAddress('email', 'name');
       $mail->isHTML(true); 
       $mail->Subject = 'Here is the subject';
       $mail->Body = 'This is the HTML message body <b>in bold!</b>';
       $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
       $mail->send(); 
       echo 'Message has been sent'; } 
  catch (Exception $e) { 
        echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; 
}

The error_log file says :

PHP Warning: stream_select(): unable to select [4]: Interrupted system call (max_fd=5) in /root/vendor/phpmailer/phpmailer/src/SMTP.php on line 1124

I have tried many examples,sometimes the it says connect() failed, sometimes couldn't connect to host and sometimes The page keeps loading and the e-mail is not sent,What is happening ? and how should I configure this . I am using godaddy cpanel php 7.

  • 写回答

1条回答 默认 最新

  • duanputian5341 2018-05-25 06:58
    关注

    The important thing here is:

    I am using godaddy

    GoDaddy blocks outbound SMTP; you must use their servers (*.secureserver.net).

    You're also using SMTPSecure = 'tls' with Port = 465, which will not work. Change to SMTPSecure = 'ssl'.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了