PHPMailer不在服务器上工作

时间:2018-01-17 17:45:42

标签: php codeigniter phpmailer

下面是我在控制器中的功能,其中包括phpmailer / PHPMailerAutoload.php 但是当我评论$ mail = new PHPMailer时,我没有收到任何错误。

请帮助我!

     function register_user() {

        $company_name = $this->input->post('company_name');
        $name = $this->input->post('name');
        $gstn_number = $this->input->post('gstn_number');
        $mobile = $this->input->post('mobile');
        $email = $this->input->post('email');
        $password = $this->input->post('password');

        if (isset($_POST["register"])) {

            $status = $this->common_model->executeNonQuery("INSERT INTO `temp_register`(`company_name`,`name`,`gstn_number`,`mobile`,`email`,`password`) VALUES ('$company_name','$name','$gstn_number','$mobile','$email','$password')");
            if ($status) {

            $mail = new PHPMailer;

            $mail->SMTPDebug = 3;
            $mail->setFrom($email, 'example');
            $mail->addAddress($mail_to, 'ac');
            $mail->Subject  = 'Request Approval Sent From User';
            $mail->Body = "Please Approve My Request!";
            $mail->send();
                echo "<script>
            alert('You have successfully requested for registration! You will be notified when request is approved, Thanks!');
            window.location.href='some_location';
            </script>";
            } else {
                echo "<script>
            alert('Problem While Requesting Please Try Again!');
            window.location.href=''location';
            </script>";
            }
        }
    }

0 个答案:

没有答案