ben03 Posted April 15, 2009 Share Posted April 15, 2009 I have been working on a webform which is new to me. When testing it I discovered the host company required 2 email addresses (normal one and root) in order to validate. So I had to add the code they suggested to the sendmail.php file as seen below. Will this validate and if not what would be the correct code in order for these problems to be corrected? Thanks. <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php mail("service@site.com", "Register Interest Form Results", $_REQUEST[message], "From: $_REQUEST[email]", "-froot@site.com".$_REQUEST[email]); $MESSAGE_BODY = "Name: ".$_POST["name"]." "; $MESSAGE_BODY .= "Email: ".$_POST["email"]." "; $MESSAGE_BODY .= "Phone: ".$_POST["phone"]." "; $MESSAGE_BODY .= "Company: ".$_POST["company"]." "; $MESSAGE_BODY .= "Jobtitle: ".$_POST["jobtitle"]." "; $MESSAGE_BODY .= "Besttime2call: ".$_POST["besttime2call"]." "; $MESSAGE_BODY .= "Howdidyouhear: ".$_POST["howdidyouhear"]." "; $boxes = ''; if (isset($_POST['boxes']) && is_array($_POST['boxes'])) $boxes = implode(', ', $_POST['boxes']); $MESSAGE_BODY .= "Options: ".$boxes; $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])." "; mail($ToEmail, $EmailSubject, $MESSAGE_BODY) or die ("Failure"); header( "Location: http://www.site.com/thankyou.html" ); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/154178-realistic-form-code/ Share on other sites More sharing options...
ober Posted April 15, 2009 Share Posted April 15, 2009 I have never seen a setup like that so only your host would know the correct configuration, which I assume they supplied to you and you added to the above? Quote Link to comment https://forums.phpfreaks.com/topic/154178-realistic-form-code/#findComment-810700 Share on other sites More sharing options...
premiso Posted April 15, 2009 Share Posted April 15, 2009 Doubtful, not sure why they would require the root@site.com Have you tried it like this... mail("service@site.com", "Register Interest Form Results", $_REQUEST['message'], "From: $_REQUEST['email']", "-f".$_REQUEST['email']); I generally add the -f which simply sets the "from" at the sendmail level. Which generally yields good results. If your host requires it then yes. You need it. If it does not, then no. You can omit it. Quote Link to comment https://forums.phpfreaks.com/topic/154178-realistic-form-code/#findComment-810703 Share on other sites More sharing options...
ben03 Posted April 16, 2009 Author Share Posted April 16, 2009 It doesn't seem to have displayed :'( The hosts said you have to use the -f parameter. What do you use for that if its sent from a html page? I have never seen a setup like that so only your host would know the correct configuration, which I assume they supplied to you and you added to the above? Yes the (mail); and the (header); part at the end of the code is what they asked me to use. Quote Link to comment https://forums.phpfreaks.com/topic/154178-realistic-form-code/#findComment-811565 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.