Showing results for 
Show  only  | Search instead for 
Did you mean: 

PHP mail() not sending (Linux server)

GoDaddy recently switched me to a new Linux server using cPanel. When they did that, I could no longer send email using PHP mail(). I am not sure what version of PHP I would be using because the Dashboard/Server says 7.2 but the cPanel Server Information says 5.6.40. I have no idea what this is telling me or if has anything to do with my problem. Here is the code:


$message = "From: " . $_POST['FirstName'] . " " . $_POST['LastName'];
$message .= "\r\nEmail: " .  $_POST['Email'];
$message .= "\r\nPhone: " . $_POST['Phone'];
$message .= "\r\nSubject: " . $_POST['Subject'];
$message .= "\r\nComment:\r\n" . $_POST['Comment'];

$header = "From:\r\n";
$header .= "To:\r\n";

$result = mail("","Request From Site", $message, $header);

if ($result) {
	echo "Sent Result=$result \r\n$header\r\n";
else {
	echo "NOT SENT Result=$result";


The mail function always returns True, or 1, so it seems that it is being passed off to the email server without any problems. I didn't used to have any $header but other posts mentioned it and so I tried it. No luck there. Everything is going on within the same domain and I am not trying to use any other email provider. I have spent hours, many hours, on this. The only thing I can think of, besides that I am making some mistake (hey, it has happened before Smiley Very Happy) is that GoDaddy, when making the switch, has some new requirement (that is, a gotcha) that they haven't seemed to make easy to find. So, if a GoDaddy person reads this, what would it take for you to reveal your magic?


Thanks for any help,

Paul S