PHP mail() problem; me or my host?

Hi Guys,

I'm on a shared hosting plan on a Linux server running Apache and PHP 4.4.0.

I'm having a problem with the PHP mail() function. It doesn't work. I've tested the following code on both my site and a friend's site who's hosted through the same host, but is on a different server...


$result = @mail("myemail@myemail.com", "the subject", "the message", "From: webmaster@{$_SERVER['SERVER_NAME']}", "-fwebmaster@{$_SERVER['SERVER_NAME']}");

if (!$result){
echo "nope, sorry";
} else {
echo "woot!";
}


On my friend's site it works just fine, on my site it does not. After months of double checking things to be absolutely sure it was not a problem on my end, I contacted my host about it. They uploaded a PHP file to my site with the phpinfo() function in it and told me to look at that for the correct settings and also gave me links to the PHP manual. Basically telling me that I'm an idiot and that I need to learn PHP.

I'll admit that I know very little about web servers and the administration of them, but I do have a fairly good understanding of PHP.

My question to the clever folk here is this; Can I be 100% certain this is not a problem on my end? And if so, can you think of a reason the mail() function would not be working on the server I'm on? Was I justified in feeling rather insulted that they told me it was my code?

I've read that the user who's compiling PHP must have access to sendmail at compile time, could that be it? phpinfo() seems to show the correct path to sendmail.

Thanks in advance,

Keith J.

 

 

 

 

Top