2012-10-15 139 views
1

PHPmailer在本地主機工作正常,但當它在服務器上顯示SMTP錯誤,以前它工作但罰款,但最近它不工作。這個問題發生在我的所有cPanel中,它可能是經銷商帳戶服務器問題嗎?我正在使用下面的代碼,並且出現如下錯誤: SMTP錯誤:無法進行身份驗證。phpmailer工作正常本地主機,但作爲服務器

function mail_sending($to_address, $to_name, $title_tag, $subject_tag, $mail_body) 
{ 
    $mail = new PHPMailer(); 
    //End Code for adding a Page 
    $mail->IsSMTP(); // telling the class to use SMTP 
    $mail->SMTPAuth = true;     // enable SMTP authentication 
    $mail->SMTPSecure = "ssl";     // sets the prefix to the servier 
    $mail->Host = "myhost.com";  // sets the SMTP server 
    $mail->Port = 465;      // set the SMTP port 
    $mail->Username = "[email protected]"; // username 
    $mail->Password = "password"; 

    $mail->SetFrom('[email protected]', $title_tag); 

    $mail->Subject = $subject_tag; 

    //End Attachments 
    //Start code for sending a html Body 
    $mail->IsHTML(true); 
    $mail->Body = $mail_body; 
    //End code for sending a html Body 
    $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; 
    $mail->AddAddress($to_address, $to_name); 

    $mail->Send(); 
} 

回答

0

從它出現在本地服務器需要認證信息錯誤信息之前,讓我們發送的任何郵件。

您可以指定的信息是這樣說:

$mail->SMTPAuth = true; // turn on SMTP authentication 
$mail->Username = 「[email protected]」; // SMTP username 
$mail->Password = 「password」; // SMTP password 

usernamepassword應該是你方關於SMTP使用您的託管服務提供商得到的,我相信他們得到的常見問題,也可以幫助你。

0

確保你的服務器中啓用了您的OpenSSL:

1. Login through WHM with your root account; 
2. Select or search for "EasyApache (Apache Update)"; 
3. Select "Start customizing based on profile"; 
4. Select "Next step"; 
5. Select "Next step"; 
6. Select "Next step"; 
7. Select "Exhaustive Options List"; 
8. Select "OpenSSL"; 
9. Select "Save and Build" and choose "Yes" in the following questions. 

的更多信息:http://forums.cpanel.net/f5/enable-php-openssl-machine-whm-cpanel-222991.html

相關問題