php
  • email
  • phpmailer
  • 2016-11-09 68 views 0 likes 
    0
    $mail->From = "[email protected]"; 
    $mail->FromName = "Example"; 
    $mail->AddAddress($regMail); 
    $mail->AddReplyTo("[email protected]"); 
    $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錯誤:數據未被接受使用PHPMailer出現錯誤

    +2

    請向我們提供錯誤。 – chris85

    +0

    郵寄程序錯誤:SMTP錯誤:數據未被接受。 – Kavi

    回答

    0

    嘗試一些像這樣的事情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('[email protected]'); 
        $mail->SetFrom('[email protected]', 'my name'); 
        $mail->Subject = 'Please verify your Email Address '; 
        $mail->AddAddress('[email protected]', '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; 
        } 
    

    這裏下載https://github.com/PHPMailer/PHPMailer

    打開的PHPMailer在這裏https://www.google.com/settings/security/lesssecureapps

    相關問題