我正在使用mail函数发送带有.doc文件附件的邮件。但是,当我尝试使用Windows时,它无法正常工作而且邮件没有被发送,但如果我使用linux它就能正常工作。我没有得到确切的问题。
include("/PHPMailer/class.phpmailer.php");
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "email-smtp.us-west-2.amazonaws.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "AKIAI7QGRLIUQB2ALZRQ";
$mail->Password = "AjHaB8Q8vo1ZpCATHDrd7ZGgebInUtI8DxBt1m2ntAHB";
//$mail->SetFrom("info@socialnightlife.com");
$mail->SetFrom("noreply@socialnightlife.com", "socialnightlife.com");
$mail->FromName = 'socialnightlife.com';
$mail->Subject = $subj;
$mail->Body = $message;
$mail->AddAttachment($file);
$mail->AddAddress($to);
try
{
$mail->send();
}
catch (phpmailerException $e){
echo $e->errorMessage();
}
任何人都知道代码无效的确切原因。