0

この連絡先フォームを機能させようとしていますが、gmail アドレスからのものであるというヘッダーを付けて送信できないようです。yahoo アドレスも機能しないアドレスが混在しているように感じます。これは、これに関係すると思われるコードです。ホストが重要な場合、私は Dreamhost を使用しています。私に教えてください。

    if(!is_array($contact_information_type))
{
    $contact_information_type = Array();
}

if($_POST){
    $contact_name = trim(stripslashes($_POST["contact_name"]));
    $contact_company = trim(stripslashes($_POST["contact_company"]));
    $contact_address1 = trim(stripslashes($_POST["contact_address1"]));
    $contact_address2 = trim(stripslashes($_POST["contact_address2"]));
    $contact_city = trim(stripslashes($_POST["contact_city"]));
    $contact_state = trim(stripslashes($_POST["contact_state"]));
    $contact_zip = trim(stripslashes($_POST["contact_zip"]));
    $contact_country = trim(stripslashes($_POST["contact_country"]));
    $contact_phone = trim(stripslashes($_POST["contact_phone"]));
    $contact_fax = trim(stripslashes($_POST["contact_fax"]));
    $contact_email = trim(stripslashes($_POST["contact_email"]));
    $contact_comments = trim(stripslashes($_POST["contact_comments"]));
if($contact_name == ""){ $errors_array[] = "Name is required."; }
if($contact_company == ""){ $errors_array[] = "Company name is required."; }
        if($contact_city == "") { $errors_array[] = "City is required."; }

if($contact_state == ""){ $errors_array[] = "State is required."; }




if($contact_country == "") { $errors_array[] = "Country is required.";}
elseif($contact_country == "United States" ) 
{if($contact_zip != "" && !preg_match("/(^\d{5}$)|(^\d{5}-\d{4}$)/", $contact_zip)){       $errors_array[] = "Incorrect Zip. (e.g. 60660 or 60660-1234)"; };}
elseif($contact_country == "Canada" ){if($contact_zip != "" && !preg_match("/^[ABCEGHJ-    NPRSTVXY]{1}[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[ ]?[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[0-9]{1}$/i",     $contact_zip)){ $errors_array[] = "Incorrect Zip. (e.g. M4C 1B5 or M4C1B5)"; };}
                                                                                                                                                                                                                                else {;}






    if($contact_phone == ""){ $errors_array[] = "Phone is required."; }
    if($contact_phone != "" && !preg_match("/(^\d{3}-\d{3}-\d{4}$)|  (^\d{10}$)/", $contact_phone)){ $errors_array[] = "Incorrect Phone. (e.g. 123-123-1234)"; }
    if($contact_fax != "" && !preg_match("/(^\d{3}-\d{3}-\d{4}$)|(^\d{10}$)/",   $contact_fax)){ $errors_array[] = "Incorrect Fax. (e.g. 123-123-1234)"; }
    if($contact_email == ""){ $errors_array[] = "E-mail is required."; }
    if($contact_email != "" && !preg_match("/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+\.  [a-zA-Z0-9-.]+$/", $contact_email)){ $errors_array[] = "Incorrect E-mail. (e.g.   youremail@domain.com)"; }
if($contact_comments == ""){ $errors_array[] = "Comments are required."; }
    if(sizeof($errors_array) == 0){
        $contact_information_type = implode(", ",     $contact_information_type);

$email_message = <<<MESSAGE
The contact form on www.rotaryvalve.com has been filled out with the following information:


Name: ${contact_name}
Company: ${contact_company}
Address 1: ${contact_address1}
Address 2: ${contact_address2}
City: ${contact_city}
State: ${contact_state}
Zip: ${contact_zip}
Country: ${contact_country}
Phone: ${contact_phone}
Fax: ${contact_fax}
E-mail: ${contact_email}
Comments/Products of Interest: ${contact_comments}
MESSAGE;

        $email_adds = array("sales-team@wmwmeyer.com", "dan@danbaran.com");
        $email_from = $contact_email;
        $email_subject = "Customer Request/Comment";
        foreach($email_adds as $email_to){
            mail ($email_to, $email_subject, $email_message, "From: ".$email_from." <".$email_from.">");
        }

基本的に、フォームに入力された contact_email (コードは含まれていません。必要だとは思いませんでしたが、必要な場合はお知らせください) が Gmail アカウントである場合、それは送信されないようです。これについて私を助けてください。 .

4

2 に答える 2

2

問題は送信されていないか、受信されていません。問題は送信された電子メールではなく、受信者の電子メール サービスによって受信されたときに何が起こるかだと確信しています。GMail メールサーバーから送信されたものではないことがわかるため、スパムとして分類される可能性があります。

于 2012-08-10T19:40:12.583 に答える
1

gmail.com ドメインの SPF レコードがメールをスパムとしてマークする可能性が高いため、メールは受信サーバーまたはクライアントによってスパムとして分類される場合があります。

ただし、連絡先フォームに入力された電子メールの「Reply-To」ヘッダーを含む電子メールを送信することはできます。これにより、メールがスパム フィルターを通過する可能性が高くなり、受信者がクライアントの [返信] ボタンをクリックすると、メールはデフォルトでこのアドレスに送信されます。

于 2012-08-10T19:56:16.470 に答える