Jump to content

Simple email php


11Tami

Recommended Posts

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";}
}              
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.