PDA

View Full Version : PHP mail script



Diesel
12-10-2003, 10:39 AM
Hello

A website I've built for a client is having some issues with the PHP mailer I've built for it. I've used this code on over 5 sites and they all work except this one.


<?php
if($sentemail == "2"){
include("sorry.php");

}else{

$num = $sentmessage + 1;
setcookie("sentemail","$num",time()+600); //set the cookie

$emailmsg = "Sender Name:\t$name
E-Mail:\t$email\n\n
E-mail Subject:\t$emailsubject\n
Message:
\t$emailmessage\n
Contact Information:
\t$address
\t$city, $state $zip\n";
$to = "anyone@anywhere.com";
$subject = "Information Request";
$mailheaders = "From: $email <> \n";
$mailheaders .= "Reply-To: $email\n\n";
mail($to, $subject, $emailmsg, $mailheaders);
include("thanksecho.php");
}
?>

Once he installed this to his server we found out that he did not have PHP installed. So I installed it on his server and configured the .ini file. This is the error that I receive.

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in e:\blakleysinternet\thanks3.php on line 22


I've set the "sendmail_from" in the .ini file but that didn't seem to help any. I've tried a couple other things but nothing seems to work. Since the code is used ,and working, on several other sites I feel its a problem in the .ini or server. Any ideas?

redcircle
12-10-2003, 02:33 PM
how are the values input into the email. are they from a form or database. Take a look at register_globals. If register_globals is off then you will need to use the superglobals $_POST['email'] or $_GET['email']

datahound
12-26-2003, 01:36 PM
Headers need "",

I would suggest you try changing this line

mail($to, $subject, $emailmsg, "$mailheaders");

Let me know if it works.

redcircle
12-26-2003, 01:45 PM
putting quotes around a variable will do nothing.