• 0

PHP emailer - landing in client spam?


Question

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.

<?php

ini_set('display_errors','On');
error_reporting(E_ALL);

$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.

Cheers,

Alex

Link to comment
https://www.neowin.net/forum/topic/1154312-php-emailer-landing-in-client-spam/
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.