I have this form
<form method="POST" action="mailer.php">
<div id="email"><input type="email" name="email" class="email" placeholder="[email protected]"></div>
</form>
And this PHP
<?php
$email = $_POST['email'];
$to = "[email protected]";
$subject = "ADD THIS EMAIL ADDRESS TO THE MAILING LIST";
$body = "\n\n";
$url = 'http://10.0.1.1/~ewiuf';
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo '<script> alert("PLEASE ENTER A VALID EMAIL ADDRESS") </script>';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=' . $url . '">';
} else {
if (mail($to, $subject, $body)) {
echo '<script> alert("THANK YOU FOR SUBSCRIBING TO THE NEWSLETTER") </script>';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=' . $url . '">';
} else {
echo '<script> alert("THERE WAS AN UNEXPECTED ERROR. PLEASE TRY AGAIN LATER") </script>';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL=' . $url . '">';
}
}
?>
Why is the contents of the form, which should be email addresses, not being included in the body of the emails which the script sends? The script sends, verifies, but the email address that the user enters into the form is not sent to me. Please Help, thanks.
Copyright Notice:Content Author:「user852974」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7458540/php-mailer-does-not-include-body