폼메일 언어셋 관련 질문드립니다.

폼메일 언어셋 관련 질문드립니다.

QA

폼메일 언어셋 관련 질문드립니다.

본문

능력자 덕셔리님께서 공유해주신 폼메일 소스를 이용해서 폼메일 기능을 사용중입니다.

아래의 글을 참고했습니다.

폼메일 보내기 : https://goo.gl/dE5wYN


잘 사용하던 중 문제가 생겼습니다.. 

네이버나 구글 등의 포털메일에는 괜찮은데 hiworks 계정으로 메일을 보내면 제목 한글이 깨집니다. 

그런데 내용은 깨지지 않습니다..


그래서 send.php의 인코딩을 ANSI로 바꿔서 저장해보았더니 이번엔 내용의 한글이 깨집니다.

혹시 어느 부분을 수정해야 하는지 알 수 있을까요 ㅠㅠㅠ


<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['company_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']; //  required

    $email_from = $_POST['email']; // not required

    $comments = $_POST['comments']; // not 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.<br />';

  }

    

  if(strlen($comments) < 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($first_name)."\n\n";

    $email_message .= "<br>";

$email_message .= "연락처 : ".clean_string($telephone)."\n\n";

    $email_message .= "<br>";

    $email_message .= "이메일주소 : ".clean_string($email_from)."\n\n";

    $email_message .= "<br>";

    $email_message .= "문의내용 : ".clean_string($comments)."\n\n";


// create email headers

//$headers = 'From: '.$email_from;


//$headers = 'From: '.$email_from ;

// 제목이 깨질경우 아래 캐릭터셋 적용

// echo "1:".$email_to."<br><br>";

// echo "2:".$email_subject."<br><br>";

// echo "3:".$email_message."<br><br>";

// echo "4:".$headers."<br><br>";




 $headers .= "From: \"$form_name\" <$email_from>\n";


 $headers .= "Return-Path: <$email_from>\n";

 $headers .= "Content-Type: text/html;";

 $headers .= "charset=utf-8\n";

// $email_message = stripslashes($email_message);


  //echo "$to_email<br><br>$subject<br><br>$morningbody<br><br>$header";

  //exit;


//  @mail($to_email,$subject,$morningbody,$header);

     

@mail($email_to, $email_subject, $email_message, $headers);  

//exit;

?>

 

<!-- include your own success html here -->

 


<script>

alert ("메일이 발송되었습니다.\n빠른 시일안에 답변드리겠습니다.");

location.href='/';

</script>

 

<?php

}

?>

이 질문에 댓글 쓰기 :

답변 1

hiworks 계정만 그렇다면 받는메일서버에서 문제가 있지 않을까요?

답변을 작성하시기 전에 로그인 해주세요.
전체 123,127 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT