我有以下代码,我收到以下错误:
我使用的是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();
}