I create a simple mail program called sendmail.php
The only problem is, that when the user fills out the form on a different page this script doesn't validate the email or if all fields have input. Can someone modify the script to validate the email and to check the fields if they are blank or not and return an error if blank.
$fp = popen('/usr/sbin/sendmail -t', "w");
fputs($fp,"To: New Dream Scripts <$admin>\n");
fputs($fp,"From: $realname <$email>\n");
if ($ccself == "yes") {
fputs($fp,"Cc: $realname <$email>\n");
}
fputs($fp,"X-Mailer: PHP " . phpversion());
fputs($fp,"\n");
fputs($fp,"X-Sender: New Dream Scripts <$admin>\n");
fputs($fp,"Subject: $subject\n\n");
fputs($fp,"$message\n\n");
fputs($fp,"Please visit us again!\n");
fputs($fp,"http://somesite.com\n\n\n");
fputs($fp,"IP Address: $ip\n");
fputs($fp,"Referring URL: $hr\n");
fputs($fp,"HTTP Host: $hh\n\n");
pclose($fp);
thanks
p.s. - don't change any of the code i have now unless its neccessary, just add code around it if possible.