verano Posted August 11, 2009 Share Posted August 11, 2009 When I use this form, I get the "We encountered an error sending your mail, please notify [email protected]" Error message. how can i fix this. Please help! <?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{"Phone"} = "Phone"; $fields{"list"} = "Mailing List"; $fields{"Message"} = "Message"; $body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: [email protected]"; $subject2 = "Thank you for contacting us"; $autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.oursite.com"; 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.YourDomain.com/thankyou.html" );} else {print "We encountered an error sending your mail, please notify [email protected]"; } } } ?> Link to comment https://forums.phpfreaks.com/topic/169700-simple-htmlphp-form-to-email-error-message-but-dont-know-php/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 11, 2009 Share Posted August 11, 2009 Add the following two lines of code immediately after the first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/169700-simple-htmlphp-form-to-email-error-message-but-dont-know-php/#findComment-895251 Share on other sites More sharing options...
verano Posted August 11, 2009 Author Share Posted August 11, 2009 Completed. Add the following two lines of code immediately after the first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/169700-simple-htmlphp-form-to-email-error-message-but-dont-know-php/#findComment-895277 Share on other sites More sharing options...
verano Posted August 11, 2009 Author Share Posted August 11, 2009 the link for this is http://www.ipetrescue.com/addsite.html Link to comment https://forums.phpfreaks.com/topic/169700-simple-htmlphp-form-to-email-error-message-but-dont-know-php/#findComment-895278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.