Jump to content


PHP emailer - landing in client spam?

  • Please log in to reply
1 reply to this topic

#1 Axel


    --[Est. 1986]--

  • Joined: 05-August 03
  • Location: Milton Keynes, UK

Posted 24 May 2013 - 08:46

Hi all,

I thought I'd be smart and write a form page which would automatically construct an email to send to the specified client.



$emailto = $_POST['emailto'];
$emailfrom = $_POST['emailfrom'];
$subject = $_POST['subject'];
$name = $_POST['name'];
$date = $_POST['date'];
$time = $_POST['time'];
$location = $_POST['location'];
$maplink = $_POST['maplink'];

$screenername = $_POST['screenername'];
$room = $_POST['room'];
$yourname = $_POST['yourname'];

$headers = 'From: '.$emailfrom. "\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$body = $_POST['emailbody'];

mail($emailto, $subject, $body, $headers);
echo "<h3 style='font-size: 20px;'>Success.</h3>";
echo "<p>The email has been successfully sent.</p>";

the $emailfrom variable is typically set to one of three company domains, for example:

Company Name <admin@companyname.com>

Thing is they receive all the other emails just fine when I send it from that email address via outlook. The webserver its being sent from is a rackspace one.



#2 ZakO



  • Tech Issues Solved: 3
  • Joined: 21-September 07
  • Location: Finland

Posted 24 May 2013 - 08:52

Does your server have a dedicated IP or a shared one? If it's a shared IP it may be on one of the mail blacklists due to spam, have you checked? http://mxtoolbox.com/blacklists.aspx

If the IP isn't on a blacklist, it's probably because you're sending "from" admin@companyname.com but from a different domain (e.g. mydomain.com) and it doesn't have permission, two ways to correct this would be:

1. Send "from" admin@mydomain.com (mydomain.com being the domain actually sending the email), but add a "reply-to" header of admin@companyname.com

2. Sign the email with a domainkey: http://www.codinghor...rough-code.html