我有 php 联系表格,一旦提交就会发送自动回复。我们遇到的问题是,当收件人是@aol.com 时,他们会被报告为垃圾邮件给 AOL。我们希望仅针对 @aol.com 地址禁用自动响应
<?php
//Collect contact form data
//Check Special Field
//Email ASC & Webmaster
//Email Sender
//Redirect to thank you page
require_once($_SERVER['DOCUMENT_ROOT'].'/includes/functions.php');
/******** CONTACT DATA **********/
$name = stripslashes($_POST['name']);
$company = stripslashes($_POST['company']);
$address = stripslashes($_POST['address']);
$city = stripslashes($_POST['city']);
$state = stripslashes($_POST['state']);
$zipcode = stripslashes($_POST['zipcode']);
$country = stripslashes($_POST['country']);
$website = $_POST['website'];
$phone = stripslashes($_POST['phone']);
$fax = stripslashes($_POST['fax']);
$email = stripslashes($_POST['contact']);
$Referred = stripslashes($_POST['referred']);
$CustomerType = stripslashes($_POST['CustomerType']);
$Comments = stripslashes($_POST['comments']);
/******** CHECK SPECIAL FIELD **********/
$spamcheck = stripslashes($_POST['email']);
//if spamcheck is blank complete page
if ($spamcheck=="") {
/******** EMAIL ASC & WEBMASTER **********/
$message = "
-----------------------------------------------------------------------------
Information Inquiry
-----------------------------------------------------------------------------
$name has visited the Coastal web site and would like some information.
The details they entered on the website are:
Name: $name
Company: $company
Address: $address
City: $city
State: $state
Zip Code: $zipcode
Country: $country
Website: $website
Phone: $phone
Fax: $fax
Email: $email
Referred to web site: $Referred
CustomerType: $CustomerType
Comments: $Comments
Kind Regards,
Coastal Pet Products, Inc.
http://www.coastalpet.com
";
$email_address = "ashley.brindle@coastalpet.com, robert.kendall@coastalpet.com, heather.hartman@coastalpet.com";
$subject = "Information Inquiry";
$headers = "From: $name <$email>";
$message = str_replace("\r",'',$message); //fixes postfix php bug that double spaces messages
/******** EMAIL SENDER **********/
$message2 = "
-----------------------------------------------------------------------------
Re: Information Inquiry
-----------------------------------------------------------------------------
Thank you $name for visiting the Coastal Pet Products web site. We will be using the details you entered to contact you.
Name: $name
Company: $company
Address: $address
City: $city
State: $state
Zip Code: $zipcode
Country: $country
Website: $website
Phone: $phone
Fax: $fax
Email: $email
Referred to web site: $Referred
CustomerType: $CustomerType
Comments: $Comments
Kind Regards,
Coastal Pet Products, Inc
http://www.coastalpet.com
";
$email_address2 = "$email";
$subject2 = "Re: Information Inquiry";
$headers2 = "From: Coastal Pet Products <ashley.brindle@coastalpet.com>";
$message2 = str_replace("\r",'',$message2); //fixes postfix php bug that double spaces messages
//send message 1 and save result in success var (either true for success,
// or false for fail
$success = mail(mail($email_address2, $subject2, $message, $headers2) && mail($email_address, $subject, $message, $headers))
//conditionaly send message2, no need to check success on this one
if (strpos($email,'@aol.com') == false) {
mail(mail($email_address2, $subject2, $message2, $headers2) && mail($email_address, $subject, $message, $headers))
}
if ($success){
//show success message
success
}
else{
//fail message
fail
}
?>
<h3>Thank you for your interest in Coastal Pet Products!</h3>
<p>If you have asked us to contact you, we will be using the information you provided. We thank you for taking the time to help us be a better company.</p>
<?php } else { ?>
<p>There was a problem submitting your information. Please try again.</p>
<p>If you continue to have problems, please contact Customer Service at 1-800-321-0248.</p>
<?php }
?>