11Tami Posted November 8, 2007 Share Posted November 8, 2007 Hello, I'm trying to send a simple select choice to an email. So whatever selection someone picks in the drop down box is sent to my email. I've read up on this thoroughly and nothing at all with this is being sent to my email. Can't figure out why. I even included an echo that if the mail function works to state it is working. If its not working to echo it isn't working. It echos its working just fine but nothing is still being sent to my email. Will someone please look at this and tell me what I am doing wrong? Thank you very much. <?php if (!isset($_POST['submit'])) { //the submit button has NOT been clicked so make the form ?> <form action="<?php $_SERVER['PHP_SELF'] ;?>" method="post" > <select name="pickone" > <option value="small">blue</option> <option value="medium">green</option> </select> <input type="submit" name="submit"> </form> <?php } //close if not submit not pushed if (isset($_POST['submit'])) { //Submit was clicked so send to the email $email = $_POST['support@website.com'] ; $pick = $_POST['pickone'] ; $mailto = 'support@website.com' ; $subject = 'Email Subject Selection Made' ; $headers = "From: <$email>\r\n"; $headers .= "Reply-To: ".preg_replace('/[\r\n]+/', ' ', $_POST['$email'])."\r\n"; $headers .= "X-Mailer: PHP/".phpversion(); $messageproper = "Pick Selected: $pick\n\n"; mail($mailto,$subject,$messageproper,$headers); if (mail) {echo "working";} else if (!mail) {echo "not working";} } ?> Quote Link to comment Share on other sites More sharing options...
Schlo_50 Posted November 8, 2007 Share Posted November 8, 2007 Are you testing your script locally? If so, it won't work, mail scripting needs to be tested online. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 8, 2007 Share Posted November 8, 2007 Are you testing your script locally? If so, it won't work, mail scripting needs to be tested online. Not true... it will work fine from a local machine if php.ini is setup properly with SMTP. That may be the problem here, is all... PhREEEk Quote Link to comment Share on other sites More sharing options...
11Tami Posted November 8, 2007 Author Share Posted November 8, 2007 Yes its online, but doesn't work. Quote Link to comment Share on other sites More sharing options...
11Tami Posted November 8, 2007 Author Share Posted November 8, 2007 I got it, return email was set up as a post instead of only an address, thanks. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted November 8, 2007 Share Posted November 8, 2007 Glad you got it sorted... Please mark this as 'Solved'. PhREEEk Quote Link to comment 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.