集成电子邮件验证

时间:2012-07-24 16:58:37

标签: php forms validation email spam

有人可以帮我垃圾邮件证明这个PHP脚本吗?此外,当我使用这个脚本时,我收到两封电子邮件,一封是空的,另一封是结果。

<?php 
    $to = "voodoocastde@gmail.com"; 
    $subject = "Registrierung auf voodooCAST.de";
    $headers = "From: Form Mailer";
    $forward = 0;
    $location = "";

    $date = date ("l, F jS, Y"); 
    $time = date ("h:i A"); 



    $msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n"; 

    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        foreach ($_POST as $key => $value) { 
            $msg .= ucfirst ($key) ." : ". $value . "\n"; 
        }
    }
    else {
        foreach ($_GET as $key => $value) { 
        $msg .= ucfirst ($key) ." : ". $value . "\n"; 
        }
    }

    mail($to, $subject, $msg, $headers); 
    if ($forward == 1) { 
        header ("Location:$location"); 
    } 
    else { 
        header( 'Location: http://www.voodoocast.de/confirm.php' ) ;     
    } 

?>

1 个答案:

答案 0 :(得分:0)

在您的html表单中,您可以使用<input type="email"></input>并自行验证