2013-07-18 6 views
0

내 회사에 이메일을 보내려는 양식의 사이트와 양식을 작성한 사용자에게 다른 사이트가 있습니다. 사이트에 모든 추가 파일을 서버에로드했지만 테스트 할 양식을 채울 때 "찾을 수 없음"이라는 오류 메시지가 나타납니다. 그것을 처리하는 PHP의 GET 메서드를 사용하고 있습니다. 저는 PHP와 웹 디자인에 익숙하지 않습니다. 고맙습니다.PHP 스크립트가 이메일을 보내지 않거나 수신하지 않습니다

<?php 
//Function that sends the email to the person who submitted the form 
function send_email(){ 
//This sends an email to the person who submitted the form 
// email fields: to, from, subject. Put your values here! 
$sendermail = '[email protected]'; 
$from = "Company<".$sendermail.">"; 
$to = $_GET['email']; 
$subject = 'Product Information'; 
$message = "A member of our sales team will be getting back to you shortly. Thank you for your interest in our great line of products."."\n\n"."Best Regards,"."\n\n"."The Team"; 
$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\n"; 
$headers .= 'From: '. $from . "\r\n" . 
'Reply-To: '. $sendermail. "\r\n" . 
'X-Mailer: PHP/' . phpversion(); 

$ok = @mail($to, $subject, $message, $headers); 

//This sends the contents of the form submission to the website owner 
$sendermail2 = $_GET['email']; 
$from2 = $_GET['first-name'].' '.$_GET['last-name'].' <'.$sendermail2.'>'; 
$to2 = '[email protected]'; 
$subject2 = 'A customer submission from the product page'; 
$message2 = "Name: ". $_GET['first-name'] ." ". $_GET['last-name'] ."\n\n". "Company: ". $_GET['company'] ."\n\n". "Email: ". $_GET['first-name'] ."\n\n". "Interest: ".$_GET['Interest']; 
$headers2 = 'MIME-Version: 1.0' . "\r\n"; 
$headers2 .= 'Content-type: text/plain; charset=iso-8859-1' . "\n"; 
$headers2 .= 'From: '. $from2 . "\r\n" . 
'Reply-To: '. $sendermail2. "\r\n" . 
'X-Mailer: PHP/' . phpversion(); 

$ok2 = @mail($to2, $subject2, $message2, $headers2); 
} 
return send_email(); 
?> 

...이 코드는 HTML 페이지의 본문에 있습니다. 레드햇 서버에 대한

<FORM ACTION="http://www.server.com/html/form_process.php" METHOD=GET> 
+0

실행중인 메일 서버는 무엇입니까? – 3ventic

+0

Apache/2.0.52 (Red Hat) 서버 – Jeremiah

+0

Apache가 웹 서버입니다. 어떤 MAIL 서버를 실행하고 있습니까? PHP 메일 기능은 마술처럼 이메일을 보내지 않습니다. 예를 들어 Postfix와 같은 SMTP 서버로 연결됩니다. –

답변

0

솔루션 : 그 후

sudo yum install postfix 

:

sudo echo "sendmail_from = [email protected]" >> /your/directory/php.ini 

그리고 마지막으로 :

sudo echo "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]" >> /your/directory/php.ini 

함께 /your/directory/php.ini 교체 실제 php.ini 디렉토리와 [email protected] 원하는 이메일 주소와 아파치, php, postfix를 다시 시작하거나 서버를 직접 시작하십시오.

+0

나는이 대답을 거의 이해하지 못한다. 나는 그것이 당신이 아니라고 확신합니다. 초보자의 관점에서 이해하기 쉬운 설명을 구할 수 있습니까? 고맙습니다. – Jeremiah

+0

예, SSH (PuTTY를 사용할 수 있음)를 통해 서버에 연결하고 작성한 명령을 실행하십시오. – user2584820

0

오류를 찾을 수 없다는 것은 일반적으로 양식을 잘못된 URL로 보내고 있음을 의미합니다. 보내려는 URL과 php 파일의 경로가 올바른지 확인하십시오.

+0

URL은 경로와의 관계가 정확히 같습니다. 그래서 나는 그렇게 확신하지 않습니다. – Jeremiah

관련 문제