2013-03-01 2 views
-1

몇 사람의 대답을 시도했지만 아무 것도 작동하지 않았습니다. 필자는 phpmail 기능이 뛰어나서 자동 응답 기능을 추가하여 발신자에게 제출 사실을 즉시 통보 할 수 있습니다.phpmail에 자동 응답 코드

내 코드는 이것이다 :

<?php 
     $mail_to_send_to = "[email protected]"; 
     $your_feedbackmail = "[email protected]"; 


     $sendflag = $_REQUEST['sendflag']; 
     if ($sendflag == "send") 
     { 
       $name = $_REQUEST['name'] ; 
       $email = $_REQUEST['email'] ; 
       $message = $_REQUEST['message'] ; 
       $headers = "From: $your_feedbackmail" . "\r\n" . "Reply-To: $name <$email>" . "\r\n" ; 
       $a = mail($mail_to_send_to, "Contact request", $message, $headers); 
       if ($a) 
       { 
        print("Message sent, thank you! You can send another"); 
       } else { 
        print("Message wasn't sent, please check that your email was filled in properly"); 
       } 
     } 
?> 

내가 autorespond에서이 같은 것을 말하고 싶은 :

Thank you for contacting us. This is an automatically generated reply confirming your submission. We will get back to you as soon as possible. 

Sincerely, 
John Doe 

답변

0

그것은 명확하지 않다 당신이 원하는 무엇을하지만 난 추측을하고. 사용자가이 양식을 사용할 때 전자 메일로 보내려고합니다. 이 코드를 사용하십시오 :

<?php 

$mail_to_send_to = "[email protected]"; 
$your_feedbackmail = "[email protected]"; 


$sendflag = $_REQUEST['sendflag']; 

if ($sendflag == "send") { 
    $name = $_REQUEST['name'] ; 
    $email = $_REQUEST['email'] ; 
    $message = $_REQUEST['message'] ; 
    $headers = "From: $your_feedbackmail" . "\r\n" . "Reply-To: $name <$email>" . "\r\n" ; 
    $a = mail($mail_to_send_to, "Contact request", $message, $headers); 
    if ($a) 
    { 
     print("Message sent, thank you! You can send another"); 
     $message_back = "Thank you for contacting us. This is an automatically generated reply confirming your submission. We will get back to you as soon as possible."; 
     mail($email, "Contact request", $message_back, $headers); 
    } else { 
     print("Message wasn't sent, please check that your email was filled in properly"); 
    } 
} 

?> 
+1

다른 검색 결과와 마찬가지로이 코드를 추가하면 전체 웹 페이지에 도달 할 수 없게됩니다. 코드를 추가하면 웹 브라우저에서 양식 페이지에 액세스 할 수 없으므로 브라우저에서 페이지를로드 할 수 있습니다. 이상한 ... 어떤 생각? – mateikav