0

我有以下代码,我收到以下错误:

我使用的是 PHPMailer_v5.1 版本。我尝试了另一个版本,但它不起作用。
有任何想法吗?

SMTP 错误:无法验证

$mail = new PHPMailer(false); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Mailer = "smtp";
$mail->SMTPSecure = "ssl"; 
$mail->Host       = "smtp.easyname.eu"; // SMTP server
$mail->Port       = 465; 
$mail->SMTPDebug  = 0;                     // enables SMTP debug information (for testing)
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Username   = "info@mydomain.net"; // SMTP account username
$mail->Password   = "*****";            // SMTP account password
$mail->AddReplyTo("$fromEmail", "$from");
$mail->AddAddress("$toEmail", "$toName");
$mail->SetFrom("$fromEmail", "$from");
$mail->Subject = "New enquiry to example (SUBJECT:'$subject')";
$mail->AltBody = "$message"; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML("$message");
$mail->Send();
if($settings['cc_sender'])
{
    $mail = new PHPMailer(false); // the true param means it will throw exceptions on errors, which we need to catch
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Mailer = "smtp";
    $mail->SMTPSecure = "ssl";
    $mail->Host       = "smtp.easyname.eu"; // SMTP server
    $mail->Port       = 465;
    $mail->SMTPDebug  = 0;                     // enables SMTP debug information (for testing)
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->Username   = "info@mydomain.net"; // SMTP account username
    $mail->Password   = "******";           // SMTP account password
    $mail->AddReplyTo("no-reply@mydaomain.net", "example Website");
    $mail->AddAddress("$fromEmail", "example Enquiry");
    $mail->SetFrom("info@mydomain.net", "example Enquiry");
    $mail->Subject = "Your enquiry from example (SUBJECT:'$subject')";
    $mail->AltBody = "$message"; // optional - MsgHTML will create an alternate automatically
    $mail->MsgHTML("$message");
    $mail->Send();
}
4

0 回答 0