I'm developing an intranet and i'm using php for all my scripting. i would wnt users to post notices to the database which will later be approved before they can be displayed. As soon as they post the notice to the database, an email should be triggered to admin containing the notice and details of the sender, but my problem is, when i tested my email script which is very simplified ( i think) nothing seemed to happen. No error message, or mail was delivered to the intended address. SMTP is ok, i tested it. I'm developing from my local machine and the server is another machine. What settings should i set to use my mail server, or did i leave any thing out. I'm using PHP 5.0 and IIS, with MySQL 5 also.
Thanks for the help.
here is the script:
<?
//$mailto='samuel@sfg.co.zw';
//$sendfield=$_GET['s_name'];
//$subject=$_GET['subject'];
//$from="From:'$sendfield'"."\n";
//$messageproper=$_GET['notice'];
//mail($mailto,$subject,$messageproper,$from) or die("hapana chaitika apa");
//Check whether the submission is made
if(isset($hidSubmit))
{
//Declarate the necessary variables
$mail_to=$_POST['txtEmailto'];
$mail_from=$_POST['txtEmailfrm'];
$mail_sub=$_POST['txtSub'];
$mail_mesg=$_POST['txtMsg'];
//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,"From:$mail_from/r/nReply-to:$mail_from"))
{
echo "<span class='textred'>E-mail has been sent successfully from $mail_sub to $mail_to</span>";
}
else
{
echo "<span class='textred'>Failed to send the E-mail from $mail_sub to $mail_to</span>";
}
}
else
{
echo"hapana chaenda";
}
?>
😕