开发者

PHP / HTML5 solution to validating emails and sending validated ones to an email address

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="example@example.com" id="subscribetext"></div>
    </form>

In an email to a sp开发者_如何学Cecified address, and also verifies the contents to be a valid email? Thanks.

Also html5 can validate emails? Is this a better way to go?


<?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.


You might want to look into SwiftMailer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜