How can I catch an error caused by mail()?

后端 未结 5 740
陌清茗
陌清茗 2020-12-01 18:06

Does anyone know how can I catch a mail error (error is displayed while sending email and the error is caused by the mailserver down) in php?

Error that was caused b

5条回答
  •  自闭症患者
    2020-12-01 18:44

    PHPMailer handles errors nicely, also a good script to use for sending mail via SMTP...

    if(!$mail->Send()) {
      echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
      echo "Message sent!";
    }
    

提交回复
热议问题