zend-frameworksmtpgmailhtml-emailzend-mail

zend_mail email marked as spam in 4th try


i am using zend_mail as html to send an email confirmation to the server, for the 1st and the 2nd test the message was forwarded to inbox but then suddenly all messages where marked as spam. this is the php code:

$mails = '<div style = "background-color:#6BC6D3;">

<div style = "background-color: #FFFFFF;
margin: 33px auto auto;
width: 400px;
padding : 20px; 
direction: rtl;
font: 15px tahoma">
www
<br />
<br />
اtestetstststtestxs
<br />
testetstststtestxsx
<br />
<br />
<a href="http://forid.ir/user/confirm/123109231109203912">http://forid.ir/user/confirm/123109231109203912</a>

</div>
</div>

 ';
$config = array('auth' => 'login',
                'username' => 'info@forid.ir',
                'password' => '*******',);
 
$transport = new Zend_Mail_Transport_Smtp('mail.forid.ir', $config);
 
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('info@adsf.ir', 'Some Sender');
$mail->addTo('khamkhar@gmail.com', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->setBodyHtml($mails,"utf8");
$mail->setBodyText($mails);
$mail->send($transport);

and this is my email in details

Delivered-To: asdfasdf@gmail.com Received: by 10.100.120.8 with SMTP id s8csp160566anc; Sat, 19 May 2012 06:21:50 -0700 (PDT) Received: by 10.216.144.216 with SMTP id n66mr9808634wej.107.1337433710571; Sat, 19 May 2012 06:21:50 -0700 (PDT) Return-Path: info@forid.ir Received: from server6g.axspace.com ([176.9.63.137]) by mx.google.com with ESMTPS id s62si1351562weh.54.2012.05.19.06.21.50 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 19 May 2012 06:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of info@forid.ir designates 176.9.63.137 as permitted sender) client-ip=176.9.63.137; Authentication-Results: mx.google.com; spf=pass (google.com: domain of info@forid.ir designates 176.9.63.137 as permitted sender) smtp.mail=info@forid.ir Message-Id: 4fb79e6e.547ad80a.7d62.ffff8455SMTPIN_ADDED@mx.google.com Received: from server6g.axspace.com ([176.9.63.137] helo=localhost) by server6g.axspace.com with esmtpa (Exim 4.76) (envelope-from info@forid.ir) id 1SVjbp-0001po-S0 for asdfsaf@gmail.com; Sat, 19 May 2012 15:22:13 +0200 From: Some Sender info@forid.ir To: Some Recipient asdfsfd@gmail.com Subject: TestSubject Date: Sat, 19 May 2012 15:22:13 +0200 Content-Type: multipart/alternative; boundary="=_39a92918883006684b860d22bac01025" MIME-Version: 1.0

--=_39a92918883006684b860d22bac01025 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable

i have no idea why it is marked as spam, and i have no idea how to fix it, i used to think using smtp mail would solve the spam problem but it didn't. :(


Solution

  • Like @David said, your spam rating has absolutely nothing to do with using Zend_Mail. Unless you're willing to invest a lot of time and effort into configuring your mail servers for optimal delivery, I would highly recommend outsourcing your transactional email sends. ESPs like Sendgrid, Sailthru, and MailChimp will do the job way better than you can.