SMTP错误:数据未被接受PHPMailer获取错误


SMTP Error: Data not accepted Getting Error with PHPMailer

$mail->From = "info@example.com";
$mail->FromName = "Example";
$mail->AddAddress($regMail);
$mail->AddReplyTo("info@examples.com");
$mail->IsHTML(true);          
$mail->Subject = 'Please verify your Email Address';
$mail->Body    = 'To proceed with your account, we need to make sure this email address is yours. 
Please click the below link to verify your email. <br/>http://example.com/activate.php?encrypt='.$valKey.'&email='.$regMail.'&action=activate
<br><br>If you didn''t make this request, just ignore this mail.';

我得到一个错误与这些代码。但是,当我从正文中删除链接时,邮件发送成功。我不知道为什么,请帮帮我。

尝试这样设置smtp

    require 'phpmailer/PHPMailerAutoload.php';
    $mail = new PHPMailer(); 
    $mail->IsSMTP(); 
    $mail->SMTPDebug = 1; 
    $mail->SMTPAuth = true; 
    $mail->SMTPSecure = 'ssl'; 
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 465; 
    $mail->Username = ""; //Username removed
    $mail->Password = ""; //Password removed
    $mail->addReplyTo('info@examples.com');
    $mail->SetFrom('emailOne@example.com', 'my name');
    $mail->Subject = 'Please verify your Email Address ';
    $mail->AddAddress('example@yahoo.com', 'my name');
    $mail->Body    = 'To proceed with your account, we need to make sure this email address is yours. 
Please click the below link to verify your email. <br/>http://example.com/activate.php?encrypt='.$valKey.'&email='.$regMail.'&action=activate
<br><br>If you didn''t make this request, just ignore this mail.';
    if($mail->Send()) {
        echo "Message sent!";
    }else {
        echo "Mailer Error: " . $mail->ErrorInfo;
    }

下载phpmailer这里https://github.com/PHPMailer/PHPMailer

打开这里https://www.google.com/settings/security/lesssecureapps