폼메일 - 메일 받을때 내용을 테이블로 작업해서 받고 싶어요.
폼메일 소스인데 메일로 받을때
내용을 테이블로 작업해서 받고 싶어요.
send파일에서 내용출력하는 부분에 html로 테이블 짜서 넣으면
메일로 html태그가 텍스트로 다 나오는데 혹시 방법이 없을까요?ㅜㅜ
아래 이미지처럼 메일받고 싶어요.

-----------------------------send
function died($error) { // your error code can go here 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); } $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($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); ?>
답변 1개
$headers = 'From: '.$email_from; -> $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $headers .= 'From: ' . $email_from . "\r\n";
※ https://ko.code-paper.com/php/examples-html-email-with-php
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인