폼메일 $email_message 부분이 깨져서 작동합니다 ㅠㅠ 채택완료
안녕하세요 폼메일이 깨져서 질문드립니다 ㅠ
게시판에 고마우신분이 올려주신 폼메일 사용중인데
daum이나 naver에서는 깨지지 않고 잘 작동하는데
특정 웹메일에서 깨져서 보내지더라구요
혹시 해결법 아시는분은 도와주세요 ㅠㅠ

alert('메일발송을 실패하였습니다.');"; echo "history.go(-1);"; echo ""; die(); } // validation expected data exists if(!isset($_POST['first_name']) || !isset($_POST['email']) || !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']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid. '; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid. '; } if(strlen($error_message) > 0) { died($error_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($email_from)."\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); ?>
답변 3개
일부 웹메일에서는 html을 삭제시키는 경우가 있는걸로 알고있습니다.
즉 이 삭제되는거죠 그래서 깨지는것일텐데... utf-8을 php밖깥쪽이 아닌 header에 넣어보시기 바랍니다.
메타태그를 삭제하고
php 상단에
header("content-type: application/json; charset=utf-8");
넣어봐주세요
답변에 대한 댓글 4개
qkrwuddl
추가해주시면 정말정말 감사드려요~~~~~
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 2개
항목을 추가하고싶은데 ㅠㅠ 메일 실패라고나와요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인