phpMailer: Could not instantiate mail function

前端 未结 2 1696
北荒
北荒 2021-01-26 18:36

I created a form that uses phpMailer to email the results to the website owner. Of course, before I add the owner\'s email address I use mine to test that the form works. When

2条回答
  •  青春惊慌失措
    2021-01-26 18:54

    Set $mail->SMTPDebug = 2; so you can see what the server has to say, and read the troubleshooting guide.

    You're using authentication without encryption, which is not a good combination and many servers won't allow that. Add this:

    $mail->SMTPSecure = 'tls';
    $mail->Port = 587;
    

    You've based your code on an old example, so you're probably using an old version of PHPMailer too; get the latest from github.

提交回复
热议问题