PhPmailer错误“无法实例化邮件功能”

时间:2016-03-26 19:53:45

标签: php email phpmailer

我在my website上使用了PHPMailer,它可以处理大约10封电子邮件然后它停止了,现在给了我这个错误:

  

无法发送消息.Mailer错误:无法实例化邮件功能。

我还需要->IsSMTP个人电子邮件吗?

正如我所说,它适用于前10封电子邮件,然后我收到错误。

这是我的suggestion.php

ini_set('display_errors', 1);

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = trim(filter_input(INPUT_POST,"name",FILTER_SANITIZE_STRING));
    $email = trim(filter_input(INPUT_POST,"email",FILTER_SANITIZE_EMAIL));
    $details = trim(filter_input(INPUT_POST,"details",FILTER_SANITIZE_SPECIAL_CHARS));

    if ($name == "" || $email == "" || $details == "") {
        echo "Please fill in the required fields: Name, Email and Details";
        exit;
    }
    if ($_POST["address"] != "") {
        echo "Bad form input";
        exit;
    }
    require("inc/phpmailer/class.phpmailer.php");
    $mail = new PHPMailer;

    if (!$mail->ValidateAddress($email)) {
        echo "Invalid Email Address";
        exit;
    }
    //$mail->IsSMTP();
    $email_body = "";
    $email_body .= "Name: " . $name . "<br>";
    $email_body .= "Email: " . $email . "<br>";
    $email_body .= "Customer Question: " . $details . "<br>";


    $mail->setFrom($email, $name);
    $mail->addAddress('arisconstantinou@cytanet.com.cy', 'Author');     // Add a recipient

    $mail->isHTML(true);                                  // Set email format to HTML

    $mail->Subject = 'Customer Question ' . $name;
    $mail->Body    = $email_body;

    if(!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
        exit;
    }


    header("location:suggest.php?status=thanks");
}
?>

0 个答案:

没有答案