未定义方法phpmailer::issmpt()的致命错误

未定义方法phpmailer::issmpt()的致命错误,php,forms,email,Php,Forms,Email,我正在遵循phpacademy关于如何构建联系人表单的教程。一切都很好,但最后它向我显示了一个致命错误,即第27行中未定义的方法phpmailer::issmpt() <?php session_start(); require_once 'phpmailer/PHPMailerAutoload.php'; $errors = []; if(isset($_POST['name'], $_POST['email'

我正在遵循phpacademy关于如何构建联系人表单的教程。一切都很好,但最后它向我显示了一个致命错误,即第27行中未定义的方法phpmailer::issmpt()

   <?php
        session_start();


        require_once 'phpmailer/PHPMailerAutoload.php';

        $errors = [];

        if(isset($_POST['name'], $_POST['email'], $_POST['message'])){

            $fields = [
            'name' => $_POST['name'],
            'email' => $_POST['email'],
            'message' => $_POST['message']
            ];

            foreach($fields as $field =>$data){
             if(empty($data)) {
                 $errors[]= 'The' . $field . ' field is required. ';
             }  
            }

            if(empty($errors)){

                $mail = new PHPMailer;
                $mail->IsSMTP();
                $mail->SMTPAuth = true;

                $mail->Host = 'smtp.gmail.com';
                $mail->Username = 'email@gmail.com';
                $mail->Password = 'pass';
                $mail->SMPTSecure = 'ssl';
                $mail->Port = 465;

                $mail->isHTML();
                $mail->Subject = 'Contact from submitted';
                $mail->Body = 'From: ' . $fields['name'] . ' (' .$fields['email'] .') <p>' . $fields['message'] . '</p>';

            $mail->FromName = 'Contact';
            $mail->AddAddress('email@gmail.com', 'name');

            if($mail->send()){
                header('Location: thanks.php');
                die();
                }else{
                $errors[] = 'Sorry, could not send  email. Try again later.';
            }   

            }



         }else{
            $errors[] = 'Something went wrong.';
        }

        $_SESSION['errors']= $errors;
        $_SESSION['fields']= $fields;

        header('Location:index.php');

    ?>


isSMTP()
已经被标记为不推荐使用了很长一段时间。可能是因为它在当前版本的phpmailer中被删除了吗?看看这个例子:isSMTP与IsSMTP@LorenzMeyer:在PHP中,函数名查找不区分大小写。