2013-08-02 1 views
0

PHP를 통해 제출하는 문의 양식이 있지만 전달 된 이메일 주소로 전송하는 데 문제가 있습니다.왜 내 PHP 이메일 양식은 특정 주소로만 전자 메일을 보내고 있습니까?

내 사이트는 iPage에서 호스팅되며, iPage의 MX 레코드는 내 이메일과 도메인이 등록/관리되는 호버를 가리 킵니다. 호버에서 전자 메일 전달 ([email protected], 몇 년 동안 사용해온 전자 메일로 전달) 만 설정되어 있으며 매력처럼 작동합니다. [email protected] 이메일로 전송 된 모든 이메일은 내가받은 이메일에 대해 곧바로 내받은 편지함으로 전송됩니다.

그러나 내 사이트의 php 문의 양식이 내 이메일에 정보를 제공하지 않습니다. "받는 사람"입력란을 설정하여 영원히 사용한 적이있는 이메일을 보내면 연락 양식이 내 이메일에 바로 제출합니다. 그러나 "받는 사람"필드에 [email protected] 전자 메일을 사용하면 연락처 양식이받은 편지함에 도달하지 않습니다.

이 코드에 문제가되지 않습니다
<?php 

// get the posted data 
$name = $_POST["name"]; 
$band_name = $_POST["band_name"]; 
$email = $_POST["email"]; 
$link = $_POST["link"]; 
$tracking = $_POST["tracking"]; 
$mixing = $_POST["mixing"]; 
$mastering = $_POST["mastering"]; 
$reamping = $_POST["reamping"]; 
$editing = $_POST["editing"]; 
$other = $_POST["other"]; 
$comments = $_POST["comments"]; 
$songs = $_POST["songs"]; 
$link_fb = $_POST["link_fb"]; 
$link_yt = $_POST["link_yt"]; 
$link_db = $_POST["link_db"]; 

// check that a name was entered 
if (empty($name)) 
    $error = "You must enter your name."; 
// check that an email address was entered 
elseif (empty($band_name)) 
    $error = "You must enter your band's name."; 
elseif (empty($email)) 
    $error = "You must enter your email address."; 
// check for a valid email address 
elseif (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email)) 
    $error = "You must enter a valid email address."; 
elseif (empty($link_fb) && empty($link_yt) && empty($link_db)) 
    $error = "You must enter a link to for either Facebook, Youtube or Dropbox."; 
elseif (empty($tracking) && empty($mixing) && empty($mastering) && empty($reamping) && empty($editing) && empty($other)) 
    $error = "You must check either tracking, mixing, mastering, editing or other."; 
elseif (empty($comments)) 
    $error = "You must describe your project in detail."; 
elseif (empty($songs)) 
    $error = "You must enter a total song number."; 

// check if an error was found - if there was, send the user back to the form 
if (isset($error)) { 
    header("Location: /?e=".urlencode($error)); exit; 
} 

// write the email content 
$email_content = "Name: $name\n"; 
$email_content .= "Email Address: $email\n"; 
$email_content .= "Band Name: $band_name\n"; 
if (!empty($link_fb)) 
    $email_content .= "Facebook Link: $link_fb\n"; 
if (!empty($link_yt)) 
    $email_content .= "YouTube Link: $link_yt\n"; 
if (!empty($link_db)) 
    $email_content .= "Dropbox Link: $link_db\n"; 
$email_content .= "Looking for the following services:\n\n"; 
if (!empty($tracking)) 
    $email_content .= "\tTracking\n"; 
if (!empty($mixing)) 
    $email_content .= "\tMixing\n"; 
if (!empty($mastering)) 
    $email_content .= "\tMastering\n"; 
if (!empty($reamping)) 
    $email_content .= "\tReamping\n"; 
if (!empty($editing)) 
    $email_content .= "\tEditing\n"; 
if (!empty($other)) 
    $email_content .= "\tOther\n\n"; 
$email_content .= "Songs: $songs\n"; 
$email_content .= "Comments:\n\n\t$comments"; 

// send the email 
mail ("[email protected]", "Quote Request", $email_content, 'From: 456Recordings.com <[email protected]>'); 

// send the user back to the form 
header("Location: /?s=".urlencode("Thank you for your message.")); exit; 

?> 
+0

이이 문제가되지 않습니다에 저장했다,하지만 난 당신이 당신의 전체 URL을 넣어 필요하다는 것을 알고 싶은 것이라고 생각 'Location' 헤더를 사용합니다. 대부분의 브라우저는이 기능없이 작동하지만,이 방법을 따라야합니다. – Brad

답변

1

, 그것은 당신의 도메인 이름과 메일 서버 설정이 입력 된 방법에 문제가 있습니다 :

다음은 PHP 파일입니다. 등록 기관이 웹 서버의 IP 주소를 도메인의 SPF 레코드에 추가해야합니다.

기본적으로 전자 메일 공급자가 전자 메일을 받으면 전자 메일을 보낸 사람의 IP 주소가 해당 도메인의 전자 메일을 보낼 수있는 권한이 있는지 확인합니다. IP 주소를 인식하지 못하면 이메일을 삭제합니다.

확률은 gf와 같은 spf 필터링을 사용하지 않고 새 이메일 공급자 (예 : godaddy, 1and1, yahoo)를 사용하는 이메일입니다.

Google SPF 및 DKIP를 사용하면 자세한 정보를 얻을 수 있습니다. 당신의 등록 GoDaddy를있는 약간의 변화에 ​​

이 내 북마크 http://support.godaddy.com/help/article/7926/adding-or-editing-spf-records

+0

이메일에있는 스팸 필터가 상처를 입었습니다 ..... PHP 세션 저장 변수가 잘못 생각되고 있습니다 (제 생각 엔). 그래도 고쳤어, 고마워! – trevorhinesley

관련 문제