폼메일 발송시 보낸사람 주소가 root@로 나오는 오류

2023-01-25 (수) 18:03:56 2,082

타 업체 호스팅을 사용하다가 카페24로 옮긴 후부터

폼메일로 문의를 작성하면 보낸사람 메일 주소가 [email protected] 이렇게 옵니다 ㅠㅠ

원래 잘 작동되던것이고 폼 쪽은 손댄게 없어서 우선 데이터 파일만 보여드립니다

여기서 뭘 바꿔야 원래대로 잘 나올까요?ㅠ

https://sir.kr/qa/305926 이 글이 저랑 같은 오류인 것 같아서

답변해주신 방법들을 다 따라해봤는데도 안되네요...

Copy
<?php
//받는사람
  $recipient = "[email protected]";
//제목 처리
  $subject = '=?UTF-8?B?'.base64_encode("[문의]".$_GET['senduser']).'?=';
//메일주소
  $mail_from = '=?UTF-8?B?'.base64_encode($_GET['email']).'?=';

//메일내용
  $mail_body = "<table width='600' border='0' cellpadding='0' cellspacing='1' bgcolor='#CCCCCC'>

          <tr> 
          <td width='100' height='30' align='center' bgcolor='#eeeeee'>이름</td>
          <td width='400' bgcolor='#FFFFFF'>". $_GET['senduser']."</td></tr>".        
          
       " <tr> 
          <td width='100' height='30' align='center' bgcolor='#eeeeee'>연락처</td>
          <td width='400' bgcolor='#FFFFFF'>". $_GET['phone']."</td></tr>".    
          
       " <tr> 
          <td width='100' height='30' align='center' bgcolor='#eeeeee'>이메일</td>
          <td width='400' bgcolor='#FFFFFF'>". $_GET['email']."</td></tr>".    
      
       " <tr> 
          <td width='100' height='30' align='center' bgcolor='#eeeeee'>상담희망 시간</td>
          <td width='400' bgcolor='#FFFFFF'>". $_GET['check']."</td></tr>".    
      
       " <tr> 
          <td width='100' height='30' align='center' bgcolor='#eeeeee'>문의사항</td>
          <td width='400' bgcolor='#FFFFFF'>". $_GET['body']."</td></tr>".    
          
      "</table>";

 
//메일 발송처리

  $header = "From:$subject\n";
  $header = "Content-Type: text/html;charset=UTF-8";
  $header .= "From : $mail_from <".$mail_from.">\n"; 

$ext = "-f ".$_GET['email'];
$email = mail($recipient, $subject, $mail_body, $header, $ext);


  if (!$email)
    echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <script>
         window.alert('상담 신청에 실패하였습니다.');
         history.go(-1);
         </script>";
  else
    echo "         <script>
         window.alert('상담 신청이 정상적으로 처리되었습니다.');
         history.go(-1);
         </script>";
?>
|

답변 2개 / 댓글 3개

2023-01-26 (목) 05:06:05

$header .= "From :

여기서

From:

으로 바꿔 보세요.

답변에 대한 댓글 2개

사이 공백을 없애라는 말씀이실까요?ㅠ
예~~
혹시나 해서요.
2023-01-25 (수) 18:16:57

메서드 

get으로 쓰는 이유를 모르겠어요

post로 해야되요

답변에 대한 댓글 1개

post로하면 메일 자체가 안보내집니다 ㅎㅎㅎ...ㅠㅠ

답변을 작성하려면 로그인이 필요합니다.