2013-10-04 52 views
1
$headers = ''; 
$headers .= "Content-type: text/html; charset=iso-8859-1\n"; 
$headers .= "MIME-Version: 1.0" . "\r\n"; 
$headers .= "From: $fromName <$from>" . "\n"; 
$headers .= "Cc: " . "\n"; 
$headers .= "Bcc: $bcc" . "\n"; 
$headers .= "Reply-To: [email protected]" . "\r\n"; 
$headers .= "X-Mailer: PHP/" . phpversion(); 
$success = mail($to, $subject, $body, $headers, '-f [email protected]'); 

它,當我在Gmail ID發送郵件,但是當嘗試在現場發送郵件,雅虎ID,然後郵寄去的垃圾郵件工作的罰款。 可能是什麼原因?PHP的垃圾郵件爲Live ID的

+0

http://stackoverflow.com/questions/18229279/sending-email-via- php-mail-function-to-spam 這個答案也可以幫助你。 – Jeroen

+0

嘗試所有行中的回車符\ r –

回答

0

你可以嘗試添加以下

$headers = "From: [email protected]\r\n"; 
$headers .= "Reply-To: [email protected]\r\n"; 
$headers .= "Return-Path: [email protected]\r\n"; 
$headers .= "CC: [email protected]\r\n"; 
$headers .= "BCC: [email protected]\r\n"; 

這些鏈接將幫助您
http://wiki.apache.org/spamassassin/AvoidingFpsForSenders

http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html

+0

這兩個鏈接都有用 –

0

如果有可能知道是什麼讓電子郵件變成垃圾郵件,所有垃圾郵件作者都會知道避免發送垃圾郵件的方法。 真的,沒有任何人可以說會阻止你的電子郵件被轉移到垃圾郵件。

然而,在這種情況下,我認爲最大的問題是你不使用Sender Policy Framework,這證明發送者是真實的。

由於任何人都可以在From標頭中寫入任何內容,因此垃圾郵件過濾器傾向於不喜歡不證明郵件來源的郵件是有道理的。