PHP formprocessor

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Stelios
Forum Commoner
Posts: 71
Joined: Fri Feb 06, 2004 6:25 am
Location: Surrey/UK

PHP formprocessor

Post 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 :lol:

Thank you all in advance!
User avatar
code_monkey
Forum Newbie
Posts: 16
Joined: Tue Jul 08, 2003 6:13 am
Location: UK
Contact:

Post 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?
User avatar
Stelios
Forum Commoner
Posts: 71
Joined: Fri Feb 06, 2004 6:25 am
Location: Surrey/UK

my processfeedback code

Post 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>
User avatar
code_monkey
Forum Newbie
Posts: 16
Joined: Tue Jul 08, 2003 6:13 am
Location: UK
Contact:

Post 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.
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Re: PHP formprocessor

Post 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
User avatar
Stelios
Forum Commoner
Posts: 71
Joined: Fri Feb 06, 2004 6:25 am
Location: Surrey/UK

Post 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...
Post Reply