테스트 사이트 - 개발 중인 베타 버전입니다

php 메일에 첨부파일 붙여 보내는 중에 질문하나 드려봅니다. 채택완료

 

 

   

     

     

   

   

     

     

   

   

     

     

   

   

     

     

   

   

     

     

   

   

     

 

* 성 명 (Name)

     

     

* 메 일 (E-mail)
       

     

     

* 제 목 (Subject)

     

     

         

              * 내 용 (Contents)

     

     

       

* 첨부파일 (File)

     

     

         

   

 

 

 

 

=====  PHP파일은 아래와 같습니다. =====

 

 

$headers .= "From :$name<$e_mail>\r\n";

$heasers .= "X-Mailer:PHP MAILER\r\n";

 

if($upfile && $upfile_size)

{

        $filename=basename($upfile_name);

        $result=fopen($upfile,"r");

        $file=fread($result,$upfile_size);

        fclose($result);

 

        $upfile_type = "application/octet-stream";

        

        $boundary = "--------". uniqid("part");

        $headers .= "MIME-Version: 1.0 \r\n";

        $headers .= "Content-Type: multipart/mixed;        boundary=\"$boundary\"";

        

        $body .= "This is a multi-part message in MIME format.\r\n\r\n";

        $body .= "--$boundary\r\n";

        $body .= "Content-Type: text/html; charset=euc-kr\r\n";

        $body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";

        $body .= nl2br(stripslashes($contents))."\r\n\r\n";

        $body .= nl2br(stripslashes($phpworld))."\r\n\r\n";

        $body .= "--$boundary\r\n";

        

        $body .= "Content-Type: $upfile_type; name=\"$filename\"\r\n";

        $body .= "Content-Transfer-Encoding: base64\r\n\r\n";

        $body .= ereg_replace("(.{80})","\\1\r\n",base64_encode($file));

}

else

{

        $body = stripslashes($contents). "\r\n\r\n";

}

 

mail("test@test.com",$subject,$contents,$headers); 

 

?> 

 

 

이렇게  소스를 작성하고요 

 

sendmail.php 에서 

if($_POST){

print_r($_POST);

}else{

echo 'post변수가없습니다.';

}

?>

 

이렇게 날려보면 

Array ( [name] => 이름 [e_mail] => 이메일주소 [subject] => 제목 [contents] => 내용 [send] => 편지보내기 )

이렇게 날아오는데요.

 

왜   에서 파일첨부로 파일까지 넣어줬는데

sendmail 에선 파일내용을 못가져 올까요? 

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

답변 1개

채택된 답변
+20 포인트
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

큰도움 되었습니다 정보 감사합니다 ^^

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

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

로그인

전체 질문 목록

🐛 버그신고