Copy
<meta charset="utf-8"><?phpif(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['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.<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 .= "이메일 : ".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); ?> <!-- include your own success html here --> <script>alert ("메일이 발송되었습니다.\n빠른 시일안에 답변드리겠습니다.");location.href='../';</script> <?php}?>
여기서 이메일 부분을 빼니깐 작동을 안하더라고요 그 이유가
보내는사람 부분에 다른걸로 대체해서 넣어야 한다고 하는데요.
그 방법좀 알려주세요.
예를들면 받는사람이 abcd@네이버.컴 이라고 한다면 똑같이 적어 놓을려고 하거든요.
답변 2개 / 댓글 2개
채택된 답변
+20 포인트
쓰는사람이 메일주소는 안쓸수 있게 하실려는 것 같은데,
보여지는 폼부분에서 이메일부분에 vaule를 써서 임의의 메일주소를 적어놓으시고,
display:none 스타일함수를 사용하면 되겠습니다.
스크립트까지 손대실 필요가..
2017-06-16 (금) 16:00:02
https://www.w3schools.com/php/func_mail_mail.asp
메일 함수 관련 링크 이니 이 부분을 참고해서 반영해 보세요
지금 상단에 메일이라는 변수를 받아 발송되도록 처리되어지는 부분으로 보여집니다.
답변에 대한 댓글 2개
2017-06-16 (금) 16:31:15
정확히 원하시는 방법을 알지는 못하지만 만약 작업에 어려움이 있으시다면 소정의 비용은 들겠지만 작업의뢰를 요청하시거나 쪽지로 알려주시면 연락드리고 진행하는쪽으로 하겠습니다.
답변을 작성하려면 로그인이 필요합니다.