폼메일 작동안하는 문제 문의드려요 ㅠㅜ
본문
http://sir.kr/g5_skin/10486?sfl=wr_subject%7C%7Cwr_content&stx=%ED%8F%BC%EB%A9%94%EC%9D%BC
위 자료를 참고해서 폼메일기능을 넣는중인데
양식을 입력하고 확인버튼을 누르면 아래 send.php페이지로 넘어가서 멈추네요..
어디가 잘못된건지를 모르겠어어요ㅜㅜ 원래 4가지 정보를 입력받아 메일로 보내는 소스를
이름과 번호 두개로 줄였더니 작동을 안하네요
어디가 문제일까요..;
<meta charset="utf-8">
<?php
if(isset($_POST['email'])) {
$email_to = "*** 개인정보보호를 위한 이메일주소 노출방지 ***";
$email_subject = "[폼메일] 문의사항입니다.";
$email_subject = '=?UTF-8?B?'.base64_encode($email_subject).'?=';
function died($error) {
// your error code can go here
echo "<script> alert('메일발송을 실패하였습니다.');";
echo "history.go(-1);";
echo "</script>";
die();
}
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['telephone'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$first_name = $_POST['first_name']; // required
$telephone = $_POST['telephone']; // not required
$error_message = "";
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "이름 : ".clean_string($first_name)."\n\n";
$email_message .= "연락처 : ".clean_string($telephone)."\n\n";
// create email headers
$headers = 'From: '.$email_from;
// 제목이 깨질경우 아래 캐릭터셋 적용
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
<script>
alert ("메일이 발송되었습니다.\n빠른 시일안에 답변드리겠습니다.");
location.href='../';
</script>
<?php
}
?>