What am I doing wrong in PHP?

  • Thread starter Thread starter luckyouaskhole
  • Start date Start date
L

luckyouaskhole

Guest
I'm trying to set up email, and it's not working. In the php.ini file, it looks like this:

SMTP = mail.slkc.qwest.net
smtp_port = 25

; For Win32 only.
sendmail_from = [email protected]

But I get this message:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\Apache Group\Apache2\htdocs\send_simpleform.php on line 33

Why does it have 2 possible problems??!!?? I don't think I have a "From" header missing, because this is what my code looks like: Line 33 is

mail($to, $subject, $msg, $mailheaders, $from);

Here's the code:

<?

if (($_POST[sender_name] == "") ||
($_POST[sender_email] == "") ||
($_POST[message] == ""))
{
header("Location: simple_form.html");
exit;
}

$msg = "E-MAIL SENT FROM WWW SITE\n";


$msg .= "Sender's Name:\t$_POST[sender_name]\n";

$msg .= "Sender's Name:\t$_POST[sender_email]\n";

$msg .= "Sender's Name:\t$_POST[message]\n";

$to = "[email protected]";

$from = "[email protected]";

$subject = "Website feedback";

$mailheaders = "From: My Web Site <[email protected]>\n";

/* it looks like you add a .= after the 1st time the variable has been declared */

$mailheaders .= "Reply-To: $_POST[sender_email]\n";

mail($to, $subject, $msg, $mailheaders, $from);

?>
 
Back
Top