Click to See Complete Forum and Search --> : DYNAFORM PHP problem
meathane
07-22-2003, 04:40 AM
hey everyone, ive tried to set up a form, using the example they give you, and it sits currently at http://wengtheband.co.uk/example.html but when u type stuff and click submit it comes up with this
Warning: mail(): SMTP server response: 551 Bad Recipient in \\nas02\domains\w\wengtheband.co.uk\user\htdocs\dynaform.php on line 291
Warning: Cannot modify header information - headers already sent by (output started at \\nas02\domains\w\wengtheband.co.uk\user\htdocs\dynaform.php:291) in \\nas02\domains\w\wengtheband.co.uk\user\htdocs\dynaform.php on line 301
can anyone help? this dynaform looks really simple but its proving to be quite tricky.... what should i do?
thanks
From the looks of the first error, it doesn't like the email address you are trying to send it to, and the second one means that it is trying to modefy header information after content has been sent to the page...
You could try this script, if you think it might be easier: http://forums.webdeveloper.com/showthread.php?s=&threadid=9543#post48748
meathane
07-22-2003, 07:36 AM
i just tried that http://wengtheband.co.uk/example3.html and i get the exact same message, i cant understand it
it looks well easy but its not working!
Can I see the code for this page: http://wengtheband.co.uk/feedback2.php
meathane
07-22-2003, 08:17 AM
here is feedback.php
<?PHP
#######################################################
# This script is Copyright 2003, Infinity Web Design #
# Written by Ryan Brill - ryan@infinitypages.com #
# All Rights Reserved - Do not remove this notice #
#######################################################
$to = "meathane@hotmail.com";
$subject = "Results from your Request Info form"; #set the subject line
$headers = "From: Form Mailer"; #set the from address
$forward = 1; # redirect? 1 : yes || 0 : no
$location = "thanks.html"; #set page to redirect to, if 1 is above
## set up the time ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail the message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo ("Thank you for submitting our form. We will get back to you as soon as possible.");
}
?>
it just doesnt seem to like this whole part...
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
meathane
07-22-2003, 08:19 AM
sorry i meant 'here is feedback2.php'
and meathane@hotmail.com is the address i wish it to send to
Do you have a different email address that you can try it with? That seems to be the problem. The header error is only happening because of the bad receipient error...
meathane
07-22-2003, 10:49 AM
ive tried other email addresses but they dont work, i dont understand why there would be a problem with a hotmail one anyway, but i tried my uni address and it didnt work. its the feedback2.php but i cant see hwats wrong with it
meathane
07-22-2003, 10:54 AM
aha... i just changed the email address to greg@wengtheband.co.uk and it worked.
does this mean it has to be sent to an email address with the domain that i have [ ie wengtheband.co.uk ]?
Perhaps. PHP is able to send mail to other domains, but that might be a restriction imposed by the server or the sendmail...