我使用的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();
}
謝謝你的建議所有