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['[email protected]'] ;
$pick = $_POST['pickone'] ;
$mailto = '[email protected]' ; 
$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
https://forums.phpfreaks.com/topic/76485-simple-email-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.