Reputation: 2282
Can someone recommend a good php mailer that sends the contents of this single input
<form method="POST" action="mailer.php">
<div id="emailform"><input type="text" name="email" class="keywords" placeholder="[email protected]" id="subscribetext"></div>
</form>
In an email to a specified address, and also verifies the contents to be a valid email? Thanks.
Also html5 can validate emails? Is this a better way to go?
Upvotes: 0
Views: 550
Reputation: 966
<?php
$email = $_POST['email'];
if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
//code to excecute if email is invalid
}
else
{
//code to excecute if email is valid.
}
?>
This will use php's inbuilt email address validation. For javascript/HTML5, have a look at some regular expressions.
Upvotes: 1