php mail spam


Does anything here stand out that would make this email rejected by spam?

$headers  = 'MIME-Version: 1.0' . "\r\n";
	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
	$headers .= 'From: a Online Inquiry <>' . "\r\n";
	$headers .= 'BCC: a <>' . "\r\n";
	$headers .= 'Reply-to: '.$name.' <'.$email.'>' . "\r\n";
	$subject='a Online Inquiry';

	$body = "<strong>".$name." is contacting us about your ".$row['year']." ".$row['make']." ".$row['model']." for sale.</strong>
	<br /><hr><br />";
	$body .= "<strong>Phone:</strong> ".$phone."<br />";
	$body .= "<strong>Email:</strong> ".$email."<br />
	<strong>Message:</strong> ".$message."<br /><br />
	<strong>Vehicle:</strong> ".$row['year']." ".$row['make']." ".$row['model']."<br />
	<strong>Link To Ad:</strong> ".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]."<br />";

	$body = preg_replace("#(?<!\r)\n#si", "\r\n", $body);
	$headers = preg_replace('#(?<!\r)\n#si', "\r\n", $headers); 
	mail($to, $subject, $body, $headers);

Open in new window

Who is Participating?
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
<>  Are you really using 'noReply'?  Sending from a non-existent email address will get you bounced at a lot of email servers.  The 'reputation' of your mail server can affect it too.

Spam scoring and rejection is done at the receiving end.  Mail servers set up their spam criteria differently so it is hard to predict what is going to cause your email to be rejected unless someone tells you why.
jnfsmileConnect With a Mentor Web DeveloperCommented:
Maybe because it looks like an automated sales message.

Sender might do it - Do you own "" or is that an example?

The problem might be with the mail sending server and not in the code. Try to check this out.
Beverley PortlockConnect With a Mentor Commented:
Get hold of the rejected email. Most scanners attach an analysis like this

Content analysis details:   (7.6 points, 4.3 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.6 NO_REAL_NAME           From: does not include a real name
 0.9 UNDISC_RECIPS          Valid-looking To "undisclosed-recipients"
 0.9 MSGID_FROM_MTA_ID      Message-Id for external message added locally
 0.5 DNS_FROM_RFC_ABUSE     RBL: Envelope sender in
 1.4 DNS_FROM_RFC_POST      RBL: Envelope sender in
 3.4 FORGED_MUA_OUTLOOK     Forged mail pretending to be from MS Outlook

Open in new window

Failing that, install spamassassin and run your email through it.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Ray PaseurConnect With a Mentor Commented:
In addition to the other very good suggestions here, you might want to see if your hosting company is adding its own headers to your mail.  Many hosting companies do that, so they can catch spammers and throw them out of the system.  You can see if this is happening by sending an email to your own GMail test address and looking at the information in "Show original" so that you can see the headers.

You might also want to learn about the SPF and be sure it is implemented for your domain.

And even better yet, learn about Constant Contact.  Unfailingly successful and embarrassingly inexpensive.

Best regards, ~Ray
LinuxGuruConnect With a Mentor Linux Server AdministratorCommented:
Also make sure to set proper rdns (Reverse dns) to the mail ip. You can ask your hosting provider to set the rdns for the mail ip.
movieprodwAuthor Commented:
Thank you for the tips guys
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.