게시물 메일 수신시 첨부 파일 같이 올수있게 어떻게 할까요..

게시물 메일 수신시 첨부 파일 같이 올수있게 어떻게 할까요..

QA

게시물 메일 수신시 첨부 파일 같이 올수있게 어떻게 할까요..

본문

그누보드4)) 

작성자가 쓴 게시물에 첨부파일이 있는경우

게시물을 이메일로 전송받았을때 첨부파일이 안따라옵니다.

첨부파일에 대한 링크라도 따라오게 하고싶은데 어찌 하는지 모르겠습니다.

 

/bbs/write_update_mail.php 내용입니다.

 

답변 부탁합니다~

 

 

<?
// 게시물 입력시 게시자, 관리자에게 드리는 메일을 수정하고 싶으시다면 이 파일을 수정하십시오.
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=<?=$g4[charset]?>">
<title><?=$wr_subject?> 메일</title>
</head>

<style>
body, th, td, form, input, select, text, textarea, caption { font-size: 12px; font-family:굴림;}
.line {border: 1px solid #868F98;}
</style>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="25" height="25"></td>
    <td height="25"></td>
    <td width="25" height="25"></td>
</tr>
<tr>
    <td width="25" valign="top"></td>
    <td align="center" class="line" >
        <br>
        <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <table width="500" border="0" cellspacing="0" cellpadding="4">
                           
                            <tr><td width="20%" height="25" bgcolor=#F7F1D8>담당자 및 제목</td><td width="90%" bgcolor=#FBF7E7><?=$wr_subject?></td></tr>
                            <tr><td height="25" bgcolor=#F7F1D8>업체명 및 작성자</td><td bgcolor=#FBF7E7><?=$wr_name?></td></tr>
                            <tr><td height="25" bgcolor=#F7F1D8>전화</td><td bgcolor=#FBF7E7><?=$wr_4?></td></tr>
                            <tr><td height="25" bgcolor=#F7F1D8>팩스</td><td bgcolor=#FBF7E7><?=$wr_6?></td></tr>
                            <tr><td height="25" bgcolor=#F7F1D8>휴대폰</td><td bgcolor=#FBF7E7><?=$wr_7?></td></tr>
                            <tr><td height="25" bgcolor=#F7F1D8>메일주소</td><td bgcolor=#FBF7E7><?=$wr_email?></td></tr>
                           
                                
                            <tr bgcolor="#FFFFFF"> <td height="2" colspan="2"></td></tr>
                           
                            <tr><td height="25" bgcolor=#F7F1D8>제품명</td><td bgcolor=#FBF7E7><?=$wr_1?></td></tr>
                            <tr><td height="25" bgcolor=#F7F1D8>모델명</td><td bgcolor=#FBF7E7><?=$wr_2?></td></tr>
                            <tr><td height="25" bgcolor=#F7F1D8>사양</td><td bgcolor=#FBF7E7><?=$wr_3?></td></tr>
                           
                            <tr bgcolor="#FFFFFF"> <td height="2" colspan="2"></td> </tr>
                       
                        <tr><td height="25" bgcolor=#F7F1D8>첨부파일</td><td bgcolor=#FBF7E7><a href= ___★궁금한부분★_______'>다운로드</a></td></tr>
                                             
                        </table>

                     
                <p>

                <table width="500" border="0" align="center" cellpadding="4" cellspacing="0">
                <tr><td height="150" style="word-break:break-all;"><?=$wr_content?></td></tr>
                </table>
                <p>

                        <table width="500" border="0" cellpadding="0" cellspacing="0" style="table-layout:fixed">
                            <tr>
                                <td height="2" bgcolor="#E0E0E0" align="center"></td>
                            </tr>
                            <tr>
                                <td height="25" bgcolor="#EDEDED" align="center">홈페이지에서도 게시물을 확인하실 수 있습니다.[<a href='<?=$link_url?>'>바로가기</a>]</td>
                            </tr>
                        </table>
            </td>
        </tr>
        </table>
        <br>
    </td>
    <td width="25" valign="top"></td>
</tr>
</table>

</body>
</html>

이 질문에 댓글 쓰기 :

답변 3

if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가  

 

이부분 아래에

 


//첨부파일이 있는지 확인
$sql = " select bf_source, bf_file, bf_no from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no asc";
$file_result = sql_query($sql);
$files = Array();
while($file = sql_fetch_array($file_result)){
 
    $files[] = $file;
}
@sql_free_result($file_result); 

 

추가하고

 

위 소스중 빨간색 부분 대신

 


<?php
foreach($files as $file){

    $file_link = $g4['url'] . '/' . $g4['bbs'] . '/download.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id . '&no=' . $file['bf_no'];

?>

<tr><td height="25" bgcolor=#F7F1D8>첨부파일</td><td bgcolor=#FBF7E7><a href= "<?php echo $file_link; ?>"><?php echo $file['bf_source'];?> 다운로드</a></td></tr>

<?php } ?>

 

이 정도로 수정하시면 될듯합니다.

와우! 감사합니다! error 없이 잘 됩니다.
근데 다만 한가지 게시판 로그인을 하지않고 수신된 메일에 첨부파일링크를 다운받기위해
클릭하면 '잘못된 접근입니다' 라고 나오네요..
본 게시판은 쓰기/읽기/목록보기/비밀글 제한은 1로 풀려있는데요 ㅜㅜ
로그인 하지않고 다운로드는 할수없을까여..?

download.php 에서

 

// 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생

// 다른곳에서 링크 거는것을 방지하기 위한 코드

if (!get_session("ss_view_{$bo_table}_{$wr_id}"))

    alert("잘못된 접근입니다."); 

 

이 부분 때문에 그런것인데

주석에서도 달려있다시피 외부링크를 방지 하기 위한 코드 입니다.

해당 부분을 제거 하시거나

 

download.php 을 remote_download.php 와 같은 형태로 복사한후

아까 그부분을 제거 하고

메일 보내는 링크에서도 ​download.php 을 remote_download.php 로 변경하시면 될듯합니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 0 | RSS
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

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