Page 1 of 1

help with mail() function

Posted: Wed Dec 25, 2002 4:15 pm
by ja03
Hi guys,

I'm new to PHP (but have been doing much research) and have been experiencing a problem with the mail() function. When I run the following simple code on my "localhost" computer, there is no problem. But when I run it on a hosted server (windows 2000), it gives me a "server error" message. I spoke to tech support at the hosting company and he tells me its a code problem and that all windows servers are different. I know they run php and allow us to use the mail() function. I don't understand what the problem is.

<?
$to = "myemailaddress@domain.com";
$subject = "testing PHP mail";
$msg = "test";
mail("$to", "$subject", "$msg");
echo "finished!";
?>

Thanks in advance,
Jon

Posted: Wed Dec 25, 2002 5:31 pm
by evilcoder
Try this:

<?php

$to = "The email your sending to.";
$subject = "testing PHP mail";
$msg = "test";
$femail = "Your Email address";

mail("$to","$subject","$msg","From:$femail");
echo "Finished!"
?>