-
PHP help
Can anyone take a moment to have a look at my php and see what I have got wrong. When I test my form out I get a message saying:
no valid recipients in \\NAS37ENT\domains\a\alanbrannandesign.co.uk\user\ htdocs\contact.php on line 26
We encountered an error sending your mail
Below is my PHP
The link to the form is:
http://www.alanbrannandesign.co.uk/form.html
I think it may have to do with the $to = $_REQUEST['sendto'] ;
at the top of the php but im not sure.
any help would be great
cheers
<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "Web Contact Data";
$fields = array();
$fields{"Name"} = "Name";
$fields{"Company"} = "Company";
$fields{"Email"} = "Email";
$fields{"Option"} = "Option";
$fields{"Enquiry"} = "Enquiry";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: neil@alanbrannandesign.co.uk";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.alanbrannandesign.co.uk" );}
else
{print "We encountered an error sending your mail, please notify neil@alanbrannandesign.co.uk"; }
}
}
?>
-
Hi,
may I suggest to add
Code:
print "<pre>$to
$subject
$headers
$from
$subject2
$headers2</pre>";
just ahead of the mail() calls and verify that the data is correct
Musicman
-
I looked in the source code of your form and there's no 'sendTo' ID.
print the $to variable and see what you get.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|