我知道我的 php 表单在 godaddy 服务器上工作:http: //thespanishlanguageacademy.net/los-angeles/learn-spanish-kids-children/kontact.html
请自行测试,输入您的电子邮件地址,它会向您发送一份副本。
我将相同的代码复制到不同的服务器中。这个服务器不是爸爸。我知道 php 在这台服务器上工作,但由于某种原因,这种形式不工作:
http://hancockcollege.us/kontact.html
这是php代码:
// if the Email_Confirmation field is empty
if(isset($_POST['Email_Confirmation']) && $_POST['Email_Confirmation'] == ''){
// put your email address here scott.langley.ngfa@statefarm.com, slangleys@yahoo.com
$youremail = 'bomandty@gmail.com';
// prepare a "pretty" version of the message
$body .= "Thank You for contacting us! We will get back with you soon.";
$body .= "\n";
$body .= "\n";
foreach ($_POST as $Field=>$Value) {
$body .= "$Field: $Value\n";
$body .= "\n";
}
$CCUser = $_POST['EmailAddress'];
// Use the submitters email if they supplied one
// (and it isn't trying to hack your form).
// Otherwise send from your email address.
if( $_POST['EmailAddress'] && !preg_match( "/[\r\n]/", $_POST['EmailAddress']) ) {
$headers = "From: $_POST[EmailAddress]";
} else {
$headers = "From: $youremail";
}
// finally, send the message
mail($youremail, 'Form request', $body, $headers, $CCUser );
}
// otherwise, let the spammer think that they got their message through