下面是我的代碼,它在XAMPP服務器上正常工作。當我加載相同的Godaddy服務器,它給出了一個錯誤類'PHPMailer'找不到在Godaddy服務器上的PHPMailer
我已經加載了所有PHPmailer文件在godaddy服務器上。
<?php
$email_from = "[email protected]";
$from = "Name";
include_once('PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer(true);
//Send mail using gmail
$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 = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "password"; // GMAIL password
$mail->IsHTML(true);
//Typical mail data
$mail->AddAddress($email, $name);
$mail->SetFrom($email_from, $from);
?>
任何特定的原因,你不是基於PHPMailer提供的gmail示例代碼?你的代碼有一些基本的問題,通過使用它可以避免。此外,在這裏搜索GoDaddy SMTP問題 - 除了您的路徑問題,GoDaddy以阻止出站SMTP而聞名,因爲PHPMailer文檔會詳細告訴您。 – Synchro