2012-09-06 239 views
1
require("class.phpmailer.php"); 

$mail = new PHPMailer() 

$mail->From = "[email protected]"; 
$mail->AddAddress("[email protected]");     // name is optional 
$mail->AddReplyTo("[email protected]"); 

$mail->WordWrap = 50;         // set word wrap to 50 characters 
$mail->IsHTML(true);         // set email format to HTML 

$mail->Subject = "Here is the subject"; 
$mail->Body = "This is the HTML message body <b>in bold!</b>"; 
$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; 

if(!$mail->Send()) 
{ 
    echo "Message could not be sent. <p>"; 
    echo "Mailer Error: " . $mail->ErrorInfo; 
    exit; 
} 

echo "Message has been sent"; 

我不知道需要添加哪些標題,才能將電子郵件作爲垃圾郵件發送,而我該如何使用它?php mail() - 作爲垃圾郵件發送(使用php郵件庫)

//$mail->IsSMTP(); // is this necessary? 
//$mail->Host = "some host ip"; // what i need to write here? 
//$mail->SMTPAuth = true;  // is this necessary to send email NOT as spam? 
//$mail->Username = "test"; // and this? 
//$mail->Password = "secret"; // and this? 

有一段時間googling,我沒有找到任何明確的信息關於如何發送電子郵件不作爲垃圾郵件......任何想法?

+0

現在我試圖發送電子郵件至[email protected] - 但它是像發送垃圾郵件,我該怎麼辦?有沒有關於如何避免這些問題的CLEAR信息? –

+0

不幸的是,您目前使用的郵件服務器可能在過去發送垃圾郵件。您是否在共享託管計劃? –

回答

1

不幸的是,您當前使用的郵件服務器可能在過去發送垃圾郵件。您是否在共享託管計劃?因爲如果你是這樣,有可能在同一託管計劃中的其他網站通過相同的郵件服務器發送垃圾郵件/可疑/垃圾郵件。若要請嘗試並避免此問題,您應該嘗試不要使用欺騙的FROM標頭。不幸的是,如果Gmail等已經確定您使用的郵件服務器作爲垃圾郵件的來源,那麼這不太可能會發生。

0

確保From標題與您發送的服務器上可用的電子郵件地址完全匹配 - 欺騙來自標題(從host.com發送,但聲明來自[email protected])會提高您的垃圾郵件分數。

此外 - HTML頁是否良好形成以防止被標記爲垃圾郵件?例如,它是否有取消訂閱鏈接?或者不是那個郵件的主題,像「爲你自由的東西」?