폼메일이 왜 안보내질까요.. ㅠㅠ
본문
어디에 문제가 있는걸까요..
도움 부탁드립니다. ㅠㅠ
<meta charset="utf-8">
<?php
if(isset($_POST['first_name'])) {
$email_to = "@naver.com";
$email_subject = "[폼메일] 카카오톡 DB입니다.";
$email_subject = '=?UTF-8?B?'.base64_encode($email_subject).'?=';
function died($error)
{echo "<script> alert('".$error."');";
echo "history.go(-1);";
echo "</script>";
die();}
if (!isset($_POST['first_name']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])
)
{died('We are sorry, but there appears to be a problem with the form you submitted.');}
$first_name = $_POST['first_name'];
$telephone = $_POST['telephone'];
$comments = $_POST['comments'];
$error_message = "";
$brake = "http";
if(strpos($comments, $brake) !== false)
{$error_message = "잘못된 문자열이 포함되어 있습니다";
echo $error_message;}
if(strlen($first_name) < 1)
{$error_message .= '이름을 입력해 주십시오.\n';}
$telephone_exp = '/^[0-9]{9,11}$/';
if(!preg_match($telephone_exp,$telephone))
{$error_message .= '-를 제외한 9-11자리의 연락처를 입력해 주십시오.\n';}
if(strlen($comments) < 1)
{$error_message .= '문의내용을 입력해 주십시오.';}
$chk = $_POST['chk'];
if (!$chk)
{$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";
$email_message .= "문의사항 : ".clean_string($comments)."\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빠른 시간 내에 확인 후 \n연락드리겠습니다. 감사합니다.");
window.open("");
</script>
<?php
}
?>
답변 1
메일 발송을 위한 라이브러리가 누락된듯 싶습니다.
<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/mailer.lib.php');
답변을 작성하시기 전에 로그인 해주세요.