2

I'm using Zend_Mail for send multiple mails to my users It is work well but i have some problem with spam (like gmail)

I found this but didn't work for me (mail continue to go in spam folder) Zend_Mail sent email is treated as SPAM

maybe could be a problem in relation of smtp server and my "setReplyTo" ?

smtp server: authsmtp.duenove.it setReplyTo : the_email@fasys.it

the code:

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']="vobislab@libero.it";
        $cliente[0]['name']="Andrea Mariani";

        $cliente[1]['mail']="noreply.mario@gmail.com";
        $cliente[1]['name']="Andrea Gmail";


$mail = new Zend_Mail();

$mail->setReplyTo('info@fasys.it', 'Vobis Valdarno 2.0');
$mail->addHeader('X-Abuse', 'Please report abuse: andream@fasys.it');
$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('fasys@vobisvaldarno.it', '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();

}

Thanks you all in advice

Community
  • 1
  • 1
icy
  • 1,468
  • 3
  • 16
  • 36

2 Answers2

0

I think the reason that is going to spam is becouse body is too small(short)!

a_mark
  • 351
  • 1
  • 3
  • 5
0

The problem is most likely not related to Zend_Mail. If you go in your gmail account, in your spam folder and you open the message that was wrongly tagged as spam, you should see something like:

Why is this message in Spam? It contains content that's typically used in spam messages.

in a read bar just under the to/from information of the mail. That should give you a little bit of information about why the email was flagged as a spam.

For more details: http://gmailblog.blogspot.ca/2012/03/learn-why-message-ended-up-in-your-spam.html

Joel Lord
  • 2,175
  • 1
  • 18
  • 25