글 작성시 자동으로 관리자에게 메일 보내기 질문입니다
본문
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
////////////////////////////////////////////////
// 받을 사람의 이메일주소를 넣어주세요.
$emails[] = "메일주소"; // 이메일주소1
// 계속 추가할 수 있습니다.
////////////////////////////////////////////////
if ($w == '')
{
$row = sql_fetch("select * from $write_table where wr_id = '$wr_id'");
$wr_subject = get_text(stripslashes($row[wr_subject]));
$tmp_html = 0;
if (strstr($row[wr_option], "html1"))
$tmp_html = 1;
else if (strstr($row[wr_option], "html2"))
$tmp_html = 2;
$wr_content = conv_content(stripslashes($row[wr_content]), $tmp_html);
$wr_name = $row[wr_name];
$subject = "제목.";
$link_url = G5_BBS_URL."/board.php?bo_table=$bo_table&wr_id=$wr_id&$qstr";
include_once(G5_LIB_PATH."/mailer.lib.php");
ob_start();
include_once ("./write_update_mail.php");
$content = ob_get_contents();
ob_end_clean();
foreach($emails as $email)
{
if ($email)
mailer($wr_name, $wr_email, $email, $subject, $content, 1);
}
}
?>
위에 소스를 검색하여 적용해보니 제목, 작성자, 내용만 넘어가고 있습니다.
bbs폴더의 write_update_mail.php를 수정해줘야하나요?
그외의 값을 넘기려면 어디를 수정해줘야 하나요
ex)wr_1~10값 등
!-->답변 3
wr_1~10 등의 변수를 사용하는 경우에는
해당 게시판에만 메일 형태를 변경하는 것이 좋습니다.
이외에 기본 스킨의 게시판은 기존 메일 형태를 사용하는 것이 필요하기 때문입니다.
따라서, write_update_mail.php 파일을 복사하여
같은 폴더에 write_update_mail2.php 파일을 생성합니다.
그리고 위 소스에서는 아래와 같이 해당 게시판을 구분하여 적용되도록 합니다.
=================================================
if ($bo_table=="해당 게시판 아이디")
include_once
(
"./write_update_mail2.php"
);
else
include_once
(
"./write_update_mail.php"
);
=================================================
write_update_mail2.php 파일에서 아래 붉은색 코드와 같이 변수를 사용할 수 있습니다.
=====================================================================================
<div style="margin:30px auto;width:600px;border:10px solid #f7f7f7">
<div style="border:1px solid #dedede">
<h1 style="padding:30px 30px 0;background:#f7f7f7;color:#555;font-size:1.4em">
<?php echo $wr_subject ?>
</h1>
<span style="display:block;padding:10px 30px 30px;background:#f7f7f7;text-align:right">
작성자 <?php echo $wr_name ?>
</span>
<div style="margin:20px 0 0;padding:30px 30px 50px;">
변수1 <?php echo $_POST['wr_1'] ?>
</div>
<div style="margin:20px 0 0;padding:30px 30px 50px;min-height:200px;height:auto !important;height:200px;border-bottom:1px solid #eee">
<?php echo $wr_content ?>
</div>
<a href="<?php echo $link_url ?>" style="display:block;padding:30px 0;background:#484848;color:#fff;text-decoration:none;text-align:center">사이트에서 게시물 확인하기</a>
</div>
</div>
=====================================================================================
답변을 채택해 주셔서 감사드립니다. (_ _)