<?php// Email Submit// Note: filter_var() requires PHP >= 5.2.0if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['subject']) && isset($_POST['message']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {// detect & prevent header injections$test = "/(content-type|bcc:|cc:|to:)/i";foreach ( $_POST as $key => $val ) {if ( preg_match( $test, $val ) ) {exit;}}$headers = 'From: ' . $_POST["name"] . '<' . $_POST["email"] . '>' . "\r\n" .'Reply-To: ' . $_POST["email"] . "\r\n" .'X-Mailer: PHP/' . phpversion();//mail( "a@a.com", $_POST['subject'], $_POST['message'], $headers );// ^// Replace with your email }?>
- 2 回答
- 0 关注
- 684 浏览
添加回答
举报
0/150
提交
取消