-2

I've built a mailer form in php that allows me to just type in an email address and it fires an email directly to the address entered, this is to save a stupid amount of time due to the fact that i've got to send thousands. The php is below:

<?php
{
$to = $_POST['contactEmail'];
$subject = "UK Exporters - Buyers of Commercial Vehicles";
$headers = "Content-type:text/html;charset=iso-8859-1";

$message = 
"
<html><head></head><body style='font-family: arial;'>      
<span style='font-weight: bold;'>To whom it may concern,</span><br /><br />

At UK Exporters, we are buyers of Scanias, Volvos, Mercedes, Renaults, DAFs.<br /> 
Runners and non-runners.<br />
4 X 2’s, 8 x 4’s, 6 x 2’s.<br /><br />

We need your old stock for export orders. Top prices paid. For export orders. If you     have any items that you believe we would be interested in purchasing then please reply and let me know. Thank you for reading this email, we hope to hear from you soon.<br /><br />

Kind regards,<br /><br />

Sam<br />
UK Exporters<br /><br />
<img src='http://uk-exporters.co.uk/emailer/card.jpg' />
</body>
</html>"
; 

mail($to, $subject, $message, $headers);
echo "Another bites the dust! :D<br /><a href='http://uk-exporters.co.uk/emailer'>Send     another</a>"?>
<?php  }
?>

I'm not a php expert, so any help would be appreciated, i've also list the reasons why it's being marked as spam:

Content analysis details:   (5.5 points, 5.0 required)

pts rule name              description
---- ---------------------- --------------------------------------------------
-0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
                        trust
                        [82.197.130.210 listed in list.dnswl.org]
 0.0 HTML_MESSAGE           BODY: HTML included in message
 1.8 HTML_IMAGE_ONLY_08     BODY: HTML: images with 400-800 bytes of words
 1.1 MIME_HTML_ONLY         BODY: Message only has text/html MIME parts
 1.3 RDNS_NONE              Delivered to internal network by a host with no rDNS
 2.0 MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME
                            headers

The email would send perfectly well, until I tried sending an image along with it, any ideas guys?

RandomSeed
  • 29,301
  • 6
  • 52
  • 87
Aaron Lee
  • 1,146
  • 3
  • 14
  • 29
  • 2
    Umm. Look at the reasons (the positive scoring ones). Change the message so those reasons don't apply. – Quentin Mar 22 '13 at 11:04
  • The email has to contain HTML to be able to embed the image, if that's what your referring to anyway, unless you know how I can do it without using html? Which would be awesome. – Aaron Lee Mar 22 '13 at 11:05
  • "HTML included in message" has a score of "0", so no, that isn't positive scoring. – Quentin Mar 22 '13 at 11:06
  • You can create emails that have text/plain content beside the text/html too... – ppeterka Mar 22 '13 at 11:06
  • No, but the second "HTML_IMAGE_ONLY_08" is positive scoring, so again, if you know how to embed an image, without using HTML, feel free to share. – Aaron Lee Mar 22 '13 at 11:07
  • "HTML: images with 400-800 bytes of words" — How about you include some more text content? – Quentin Mar 22 '13 at 11:08
  • It's a copy of a business card you see, I can't really not have the wording on there. – Aaron Lee Mar 22 '13 at 11:08
  • 3
    That said, looking at the content of the message … it does appear to be spam. – Quentin Mar 22 '13 at 11:08
  • 1
    How would adding more text content prevent the existing text content from being there?! – Quentin Mar 22 '13 at 11:09
  • 1
    @Quentin I only looked at it now too. I'd mark this as spam without any thoughts... I actually wonder how clever this logic is! – ppeterka Mar 22 '13 at 11:09
  • Anyone got any ideas on how to shave a few points of this or not? I wonder if anyone knew anything about the "2.0 MIME_HEADER_CTYPE_ONLY" bit. – Aaron Lee Mar 22 '13 at 11:11
  • @Aaron `It's a copy of a business card you see, I can't really not have the wording on there.` The problem is NOT with the text _on_ the image (I don't think spam filters use OCR... Do they?), but with the text in the body of the message... – ppeterka Mar 22 '13 at 11:11
  • Right, it's just because it says about the bytes of data within the image. – Aaron Lee Mar 22 '13 at 11:21
  • No, it says you have images in the email at the same time as you only have 400-800 bytes of words in the email. – Quentin Mar 22 '13 at 11:53

1 Answers1

5

Your analysis details are clear enough. You need to make your header more suitable to your message, by adding the one below:

 #For 'Content-Type' found without required IME headers
 $headers .= "MIME-Version: 1.0" . "\r\n";

Also seems you missing FROM Address in header

 $headers  .= 'From: from@email.com' . "\r\n" .

For more on mail headers do read this.

Aaron Lee
  • 1,146
  • 3
  • 14
  • 29
Rikesh
  • 26,156
  • 14
  • 79
  • 87
  • This has worked perfectly, apart from the email is now being duplicated twice in the same message, it's sending one message but with the same email in twice? - EDIT: False alarm, rogue full stop. Thanks for this! – Aaron Lee Mar 22 '13 at 11:19
  • @AaronLee Not getting you ? Is it sending mail twice ? Or you getting message body twice in one mail ? – Rikesh Mar 22 '13 at 11:22