This is my first time learning php, and I wanted to create a simple newsletter, that would take the user's email as input and proceed to send a mail to that particular email, using the php mail() function without being redirected to another website, But I cant seem to get it to work.
<section id="subscribe">
<div class="container wow fadeInLeft">
<div class="subscribe text-center">
<p>Sign Up To Our Newsletter Now</p>
<div class="input-group">
<input type="email" class="form-control" name="uemail" placeholder="Enter Email ID">
<div class="input-group-append">
<button type="submit" name="submit" class="input-group-text btn">Subscribe</button>
</div>
</div>
</div>
</div>
<?php
if (isset($_POST["submit"]))
{
$email_to = $_POST["uemail"];
$subject = "simple emails with php";
$message =" Testing if this is working \n\n boop bop!";
$headers = "From: testingaux@gmail.com";
if(mail($email_to, $subject, $message, $headers) )
echo "success, email sent to $email_to" ;
else
echo 'not sent';
}
?>
</section>
Any help would be much appreciated. Thank You!