环境:xammp;Mercury 用的25端口;
PHP:
boot.contact-form{
border: 1px solid #c0c0c0;
margin-top: 30px;
border-radius: 10px;
box-shadow: 3px 3px 16px #c0c0c0;
}
.head{
height: 85px;
}
.head p{
font-size: 40px;
line-height: 85px;
}
.alert p{
font-style: italic;
}
Contact Us
function _post($str){
$val = !empty($_POST[$str]) ? $_POST[$str] : null;
return $val;
}
$name=_post("name");
$email=_post("email");
$message=_post("message");
$errors='';
$missing_name ='
Please enter your name!>';
$missing_email ='
Please enter your Email!>';
$invalid_email ='
Please enter your Valid Email!>';
$missing_message ='
Please enter your Messages!>';
if (_post("submit")){
if (!$name){
$errors.=$missing_name;
}else{
$name=filter_var($name, FILTER_SANITIZE_STRING);
}
if (!$email){
$errors.=$missing_email;
}else{
$email=filter_var($email, FILTER_SANITIZE_EMAIL);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
$errors.=$invalid_email;
}
}
if (!$message){
$errors.=$missing_message;
}else {
$message=filter_var($message, FILTER_SANITIZE_STRING);
}
if ($errors){
$resultMessage='
}else{
$to = "eric.choo1997@gmail.com";
$subject ="Contact";
$message ="
Name: $name
Email: $email
Messages:
$message
";
$headers = "Content-type:text/html";
if (mail($to, $subject, $message, $headers)){
$resultMessage='
}else{
$resultMessage='
}
}
echo $resultMessage;
}
?>
Name:
">
">
Message:
PHP.ini:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=localhost
; http://php.net/smtp-port
smtp_port=25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = eric.choo1997@yahoo.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =
Mercury的Do not permit 已经取消勾选;
试了三五个邮箱了,始终不可以。