쭌

첨부파일을 포함할 글을 게시할 때 첨부파일 포함된 내용을 메일로 보내고 싶어요.

안녕하세요.

왕초보라서 도저히 해결을 못해서 글을 띄웁니다.
게시판에 글을 작성할 때, 첨부파일을 포함해서 글을 게시할 때, 저장하면서 첨부파일 포함해서 바로 누군가에게 메일을 보내고 싶습니다.

write_update.skin.php 에 다음과 같이 넣으면 되는데 첨부파일도 포함해서 보내는 법을 모르겠습니다.

$file 를 어떻게 처리해야 되나요? 찾아보니까 bf_file 어쩌고가 게시물 저장할 때 첨부파일 같던데... 도저히 모르겠어요.

include_once("$g4[path]/lib/mailer.lib.php");
mailer("대리구매","[email protected]", "[email protected]", $wr_subject, $wr_content, 1, $bf_file);
|

댓글 4개

bbs/formmail_send.php를 참고해보세요..
제 기억으로는 첨부파일을 배열로 넘겼던거 같은데..
그럼 대략 아래처럼 하면 되지 않을까요?

<?
$res = sql_query("select bf_file from $g4[board_file_table] where bo_table='$bo_table' and wr_id='$write[wr_id]'");
$rows = array();
for ($i = 0; $row = sql_fetch_array($res); $i++)
{
$rows[$i] = "$g4[path]/data/file/$bo_table/$row[bf_file]";
}

mailer("대리구매","[email protected]", "[email protected]", $wr_subject, $wr_content, 1, $rows);
?>
이거 해결했습니다. 혼자 삽질해서...^^

include_once("$g4[path]/lib/mailer.lib.php");

$attach = array();
$attach = get_file($bo_table, $wr_id);

$filename = $attach[0][path]."/".$attach[0][file];

$fp = fopen($filename, "r");
$file[] = array(
"name"=>basename($filename),
"data"=>fread($fp, filesize($filename)));
fclose($fp);

mailer("제목","발송자", "보내느사람이메일", $wr_subject, $wr_content, 1, $file);
주기적으로 디비 백업해서 메일발송 할려고 했는데,,,
쬐금 길이 보이네요,,
쭌위님 수고 하셨습니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
08-04-21 조회 1,902
08-04-21 조회 1,027
08-04-21 조회 1,039
08-04-21 조회 1,249
08-04-21 조회 1,621
08-04-21 조회 1,677
08-04-21 조회 1,851
08-04-20 조회 1,632
08-04-20 조회 1,617
08-04-20 조회 1,549
08-04-20 조회 1,054
08-04-20 조회 1,060
08-04-20 조회 1,603
08-04-20 조회 1,081
08-04-20 조회 1,374
08-04-20 조회 1,109
08-04-20 조회 1,044
08-04-20 조회 1,601
08-04-20 조회 1,382
08-04-20 조회 1,706