,據我看你是不是考慮到代碼的其餘部分,所以我可以看到什麼錯 ,所以我將使用Gmail發送電子郵件
代碼後你的代碼IM:
$sendmail = require_once('../lib/phpmailer/class.phpmailer.php');
include("../lib/phpmailer/class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = " Body Msg ";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "smtp.gmail.com"; // sets the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // SMTP account username
$mail->Password = "pass"; // SMTP account password
$mail->SetFrom('$qemail', 'first name');
$mail->Subject = "hi name";
$mail->MsgHTML($body);
$address = "[email protected]";
$mail->AddAddress($address, "first name");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
如果你是奪眶而出嘗試代碼不要忘記設置正確的地方的類中包括功能和放在require_once
嗨,這有很多重複已在「相關」列。 –
GMail可能將其檢測爲垃圾郵件,尤其是在共享託管服務提供商的情況下。 –
您的服務器/ PHP安裝是否支持使用mail()函數?此外,你檢查垃圾郵件/垃圾等? –