0

I am trying to email the data in an html when you click on the submit button, the html form uses the POST action. My php code is:

<?php
$email = $_POST['email'];
$to      = '$email';                       //email submitted in html form
$subject = 'Welcome ';
$message = 'hello';
$headers = 'From: myaddress@email.com' . "\r\n".
'Reply-To: From: myaddress@email.com' . "\r\n".
'X-Mailer: PHP/' . phpversion();
$result = mail($to, $subject, $message, $headers);
if(!$result) {   
    echo "Error";   
} else {
    echo "Success";
}
?>

I get a success message but no email comes through, any ideas would be highly appreciated. many thanks

user3783243
  • 5,368
  • 5
  • 22
  • 41
Jon
  • 91
  • 9

0 Answers0