views:

693

answers:

3

I'm trying to sort out an opt in mailing list system. I understand the basic principles and design required but i'm having an issue with it being picked up as spam.

If i send a html email through outlook through [email protected] it works fine and is not treated as spam. When i use the Zend_mail object to send mail it sends but is treated as spam on the test emails accounts i'm sending it too.

This is the code im using to send an email item.

//send an email
  $mail = new Zend_Mail();
  $config = array('auth' => 'login','username' => '[email protected]','password' => 'mypassword');
  $transport = new Zend_Mail_Transport_Smtp('mail.domain.com', $config);
  $mail->setSubject($item->title);
  $mail->setFrom("[email protected]");
  $mail->addTo($item->email, $item->forename);
  //$mail->setBodyText($item->contentPlain);
  $mail->setBodyHtml($item->contentHTML);
  $mail->send($transport);

As you can see im using the smtp transport object to authenticate but it still seems to treat this as spam. Anyone with pointers or tips is very much appreciated!!

Header info from the email that is treated as spam:

It seems to contain a couple of client domain names in the header info that i host for people any ideas why that would be the case? I use a shared IP address with about 10 domains on it

    Received: (qmail 1436 invoked from network); 14 Aug 2009 16:02:10 +0100
    Received: from clientdomain1.co.uk (HELO localhost) (91.192.***.196)
  by clientdomain2.info with SMTP; 14 Aug 2009 16:02:10 +0100
Subject: Manchester 2 Day Seminar: Dealing with difficult people
From: [email protected]
To: Andi <[email protected]>
Date: Fri, 14 Aug 2009 15:02:10 +0000
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0
+2  A: 

"Roll your own mail" is often treated as spam by large hosted email systems. When you use a paid service to send out mass emails, you are paying for those company's agreements with the major email vendors to keep them white-listed.

One thing you can do, though, is to ensure that the account you are sending from exists and the email is being sent from a matching domain (e.g. @foo.com sent from foo.com's smtp server). That is a big red flag for spam filters.

Jeff Ober
My code above shows that im using a valid email and i use the authentication method that zend_mail provides. I know it would be easier to pay for a service to send the email out through but at the moment it isn't possible. Even if i send a single email through zend it treats it as spam but not through outlook, even though i'm using the same settings though?? cheers
Andi
A: 

Compare your email and email from outlook. Are any headers missing? Which? Do they seem significant?

Tomáš Fejfar
the significant difference is thatthe one sent from outlook gives an address from cable.ntl etc etc as opposed to my servers ip which is obviously not being treated as spam. Any suggestions?
Andi
A: 

Try this to get rid of the last localhost reference:

$protocol = new Zend_Mail_Protocol_Smtp('localhost');
$protocol->connect();
$protocol->helo('mail.yourserver.com'); //**DO THIS**

$transport->setConnection($protocol);
jessehanson1981
will try this out tonight and let you know, i think it only had localhost on this occasion as i was sending to my own email address
Andi
i tried this and it still shows localhost. I also tried setting the content as the outlook email set it to something different but it seems to ignore the mime type i was setting it too :Swill post updated headers later on
Andi