My code below not sending email to the mailing server to subscribe to a mailing list, I am confused as to why it is not working.Displays thank you webpage once submitted,not getting any response sent from list handler, if entered manually in email i get a response...
<?php
//thanku webpage routine
if (isset($_POST['submit']))
{
?>
<script type="text/javascript">
window.location = "http://www.thankyou web url here ";
</script>
<?php
}
if(isset($_POST['email'])) {
$to = "email address here" ;
$message = "SUBSCRIBE list name" ;
$subject = " ";
$email = $_POST["email"] ;
$headers = 'From: '.$email."\r\n".
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
}
?>
<form class="rform" method="post" action="https://webform web url">
<fieldset><legend><strong>Signup</strong></legend>
<h4> mailing list text here:</h4>
<p><label for="email">Email address:</label> <input title="email address." name="email" type='email' pattern=".+(@tvs.ac.uk)|.+(@tvsa.ac.uk)|.+ (@research.gla.ac.uk)" required />
</p>
<input style="float: right;" type="submit" name="submit" value="Subscribe" /> </fieldset> </form>