I have been using a php script on a Unix server with no problems. I am now switching to a Windows server and trying to use the same script. I installed php5 on the Windows server. The php page called salestest.php comes up fine, but after you fill it out here is what comes up on the page that displays there input (this comes up after there input):
PHP Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\WebData\domainname\www\salestest.php on line 73
Here is the script I am using:
<?
// The email address to send form data to:
$TO_EMAIL_ADDRESS = "sales@domainname.net";
$SUBJECT = "Sales Question";
if (empty($_POST['form_submitted'])) {
show_form();
} else {
process_form($TO_EMAIL_ADDRESS, $SUBJECT);
}
////////////////////////////////////////////
// show_form
////////////////////////////////////////////
function show_form() {
global $PHP_SELF;
echo "
<font face=\"Verdana,Tahoma,Helvetica\" size=\"-1\"><B>Sales</B></font><BR><BR>
<font face=\"Verdana,Tahoma,Helvetica\" size=\"1\"><BR>
<form method=post action=\"$PHP_SELF\">
<TABLE border=0>
<TR><TD><font face=\"Verdana,Tahoma,Helvetica\" size=\"-1\">First Name: </font></TD><TD><input type=text name=firstname></TD></TR>
<TR><TD><font face=\"Verdana,Tahoma,Helvetica\" size=\"-1\">Last Name: </font></TD><TD><input type=text name=lastname></TD></TR>
<TR><TD><font face=\"Verdana,Tahoma,Helvetica\" size=\"-1\">Email Address:</font></TD><TD><input type=text name=email>*</TD></TR>
<TR><TD><font face=\"Verdana,Tahoma,Helvetica\" size=\"-1\">Website URL:</font></TD><TD><input type=text name=websiteurl></TD></TR>
<TR><TD><font face=\"Verdana,Tahoma,Helvetica\" size=\"-1\">Sales Question</font></TD><TD><textarea name=question rows=\"5\" cols=\"50\"></textarea></TD></TR>
<TR><TD colspan=\"2\"></TD></TR>
<TR><TD></TD><TD> <input type=submit value=\"Submit\">
<input type=hidden name=form_submitted value=1></TD></TR>
</table>
</form>
</font>
";
}
////////////////////////////////////////////
// process_form
////////////////////////////////////////////
function process_form($to="", $subject="") {
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);
$email = trim($_POST['email']);
$websiteurl = trim($_POST['websiteurl']);
$question = trim($_POST['question']);
$msg = "First Name: $firstname\nLast Name: $lastname\n\nEmail Address: $email\n\nWebsite URL: $websiteurl\n\nQuestion: $question";
$headers = "From: Domainname.net<sales@domainname.net>'";
mail($to, $subject, $msg, $headers);
echo "Thank you for your question. This was sent to " .
"<b>$to</b><br>" .
"with your <b>$subject</b><br>" .
"We will reply asap.<br><BR><BR><b>" . nl2br($msg) . "</b>";
}
?>
I am new to setting up the php5 on a server but looked in the php.ini for the send_mail but not sure what to put there or if that is the issue. I want to use php for multiple sites so I don't want to modify the php.ini to be this site specific.
I would greatly appreciate any help.