폼메일이 발송이 안되네요.. 왜 그럴까요?
본문
기존 사용하던 폼메일에서
몇가지 지우고 연락처 하나만 받으려고
하는데 메일이 오지가 않네요..
도움부탁드립니다.
<meta charset="utf-8">
<?php
if(isset($_POST['telephone'])) {
$email_to = "---@naver.com";
$email_subject = "[폼메일] 견적의뢰 문의사항입니다.";
$email_subject = '=?UTF-8?B?'.base64_encode($email_subject).'?=';
function died($error) {
// your error code can go here
echo "<script> alert('메일발송을 실패하였습니다.\\n이메일 및 연락처를 정확히 입력해주세요.');";
echo "history.go(-1);";
echo "</script>";
die();
}
// validation expected data exists
if( !isset($_POST['telephone'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$telephone = $_POST['telephone']; // not required
$error_message = "";
if(strlen($telephone) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
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($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="http://---.com/";
</script>
<?php
}
?>
답변 2
|
|
메일이 안오는데는 여러가지 원인이 있을수있습니다
먼저 mail함수뒤에 들어가는 값을찍어보고
체크해보세여
먼저 mail함수뒤에 들어가는 값을찍어보고
체크해보세여
답변을 작성하시기 전에 로그인 해주세요.