Page 1 of 1
PHP formprocessor
Posted: Fri Feb 06, 2004 6:25 am
by Stelios
Hello everybody,
I have been using, actually teaching PHP to myself, for the past 10 days. I am now trying to create a comments form for my web site, so that I can recieve feedback. Everything is ready but I keep getting this error...
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in c:\program files\apache group\apache\htdocs\processfeedback.php on line 14
If anybody could help I would really appreciate
Thank you all in advance!
Posted: Fri Feb 06, 2004 6:56 am
by code_monkey
sounds like you forgot to put a from address in you call to the mail function, can you post your code so we can see whats happening?
my processfeedback code
Posted: Mon Feb 09, 2004 4:12 am
by Stelios
<?php
//create short variable names
$name=$HTTP_POST_VARS['name'];
$email=$HTTP_POST_VARS['email'];
$feedback=$HTTP_POST_VARS['feedback'];
$toaddress = '
cs11st@surrey.ac.uk';
$subject = 'Feedback from web site';
$mailcontent = 'Customer name: '.$name."\n"
.'Customer email: '.$email."\n"
."Customer comments: \n".$feedback."\n";
$fromaddress = 'From:
administrator@pyrford.surrey.sch.uk';
mail($toaddress, $subject, $mailcontent, $fromaddress);
?>
<html>
<head>
<title>Stelios's Motorbikes - Feedback Submitted</title>
</head>
<body>
<h1>Feedback submitted</h1>
<p>Your feedback has been sent.</p>
</body>
</html>
Posted: Mon Feb 09, 2004 11:15 am
by code_monkey
Interesting one, the code works fine on my server. A quick search on google did turn up a few interesting articles on the subject.
1.
http://www.phpbuilder.com/lists/php-ins ... 1/0093.php
2.
http://forums.devarticles.com/t632/sa54 ... a706b.html
My first thought was that maybe you needed a \n after the from address, but I'm guessing the cause is something else now.
What OS is your script hosted on? My one is a linux box unfortunately I can't test it on any other platforms at the moment.
Re: PHP formprocessor
Posted: Mon Feb 09, 2004 12:41 pm
by Dr Evil
Stelios wrote:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in c:\program files\apache group\apache\htdocs\processfeedback.php on line 14
Did you check your php.ini (in windows folder)?
I tested your script and it works well on windows.
In php.ini find and ajust this:
SMTP = smtp.server.com ; for win32 only
sendmail_from =
me@myaddress.com ; for win32 only
;sendmail_path = ;for unix only, may supply arguments as well ; (default is sendmail -t)
make sure you specify a valid smtp server. You might need to install
one.
Dr Evil
Posted: Wed Feb 11, 2004 7:58 am
by Stelios
Thank you all guys.It worked just fine after I checked the php.ini file which was missing the correct settings for my smtp server. Inexperience you see. Thank you all once again...