2013-07-03 27 views
1

我使用PHP郵件功能發送郵件,它傳遞給所有其他郵件服務器,但不是Gmail。郵件沒有被傳送到Gmail郵件

這裏是我的頭

$headers = "From: Somename<[email protected]>\r\n"; 
$headers .= "Reply-To: [email protected]\r\n". 
$headers .="Return-Path: [email protected]\r\n"; 
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; 
$headers .='X-Mailer: PHP/' . phpversion(); 

任何幫助將高度讚賞。謝謝。

+1

嗨,這有很多重複已在「相關」列。 –

+0

GMail可能將其檢測爲垃圾郵件,尤其是在共享託管服務提供商的情況下。 –

+0

您的服務器/ PHP安裝是否支持使用mail()函數?此外,你檢查垃圾郵件/垃圾等? –

回答

1

我看你有沒有

$headers .= "Reply-To: [email protected]\r\n". 

在你的頭,而不是

$headers .= "Reply-To: [email protected]\r\n"; 

輸入錯誤 ''而不是';',這就是它導致錯誤的原因。

+0

確實是這個問題。感謝您指出了這一點。 – tousif

1

,據我看你是不是考慮到代碼的其餘部分,所以我可以看到什麼錯 ,所以我將使用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

+0

確定將嘗試that.Thanks 是的,我已經使用PHP的郵件類 – tousif

+0

+1之前,你的努力 雖然我的問題解決了 刪除$標題=「返回路徑:銷售@ domain.net \ r \ n」。 fom標題 – tousif