2013-01-22 125 views
1

我使用的Zend_Mail用於發送多個郵件到我的用戶 它工作得很好,但我有一些問題,垃圾郵件(如Gmail)Zend的郵件和垃圾郵件

我發現這個,但對我沒有工作(郵件繼續進入垃圾郵件文件夾) Zend_Mail sent email is treated as SPAM

也許可能是關於smtp服務器和我的「setReplyTo」的問題?

SMTP服務器:authsmtp.duenove.it setReplyTo:[email protected]

代碼:

require("Zend/Mail.php"); 
require("Zend/Mail/Transport/Smtp.php"); 

$config = array('auth' => 'login', 
       'username' => 'myusername', 
       'password' => 'mypassword'); 

$transport = new Zend_Mail_Transport_Smtp('authsmtp.duenove.it', $config); 

     //test email - for test only 
     $cliente[0]['mail']="[email protected]"; 
     $cliente[0]['name']="Andrea Mariani"; 

     $cliente[1]['mail']="[email protected]"; 
     $cliente[1]['name']="Andrea Gmail"; 


$mail = new Zend_Mail(); 

$mail->setReplyTo('[email protected]', 'Vobis Valdarno 2.0'); 
$mail->addHeader('X-Abuse', 'Please report abuse: [email protected]'); 
$mail->addHeader('List-Unsubscribe', 'http://www.vobisvaldarno.it/newsletter/unsubscribe/'); 
$mail->addHeader('MIME-Version', '1.0'); 
$mail->addHeader('Content-Transfer-Encoding', '8bit'); 
$mail->addHeader('X-Mailer:', 'PHP/'.phpversion()); 

$mail->setFrom('[email protected]', 'Vobis Valdarno 2.0'); 


foreach($cliente as $k => $c){ 


$mail->addTo($c['mail'], $c['name']); 
$mail->setSubject('Hello '.$c['name'].', this is a test'); 


$body= 
'<!doctype html> 
<html> 
<head> 
    <meta charset="utf-8"> 
</head> 
<body> 
<p>test html mail</p> 
</body> 
<html>'; 

$mail->setBodyHTML($body); 


//send and clear message 
$mail->send($transport); 
$mail->clearRecipients(); 
$mail->clearSubject(); 

} 

謝謝你的建議所有

回答

0

我認爲這會的原因垃圾郵件是因爲身體太小(短)!

0

問題很可能與Zend_Mail無關。如果你進入你的Gmail賬戶,在你的垃圾郵件文件夾中,並且你打開被錯誤標記爲垃圾郵件的郵件,你應該看到類似於:

爲什麼此郵件是垃圾郵件?它包含垃圾郵件中通常使用的內容。

在讀取欄中正好在郵件的信息之下。這應該會給你一些關於電子郵件被標記爲垃圾郵件的信息。

欲瞭解更多詳情:http://gmailblog.blogspot.ca/2012/03/learn-why-message-ended-up-in-your-spam.html