메일함수로 게시물 등록시 특정인에게 이메일 발송하기

안녕하세요?

제가 연후아빠님이 올려주신 쇼핑몰 스킨을 사용하고 있는데요 상품 구매가 완료 되었을때
내용을 이메일로 발송하게 하려고 곱슬최씨님이 올려주신 게시물 작성시 특정인에게 이메일 발송하기를 보고 게시판의 order_u.php, orderlist.php에
메일함수
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

////////////////////////////////////////////////
// 받을 사람의 이메일주소를 넣어주세요.

$emails[] = "test@test.com"; // 이메일주소1
$emails[] = "test2@test.com"; // 이메일주소2
$emails[] = "test3@test.com"; // 이메일주소3
$emails[] = "test4@test.com"; // 이메일주소4
$emails[] = "test5@test.com"; // 이메일주소5
$emails[] = "test6@test.com"; // 이메일주소6

// 계속 추가할 수 있습니다.
////////////////////////////////////////////////

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 = "'{$board[bo_subject]}' 게시판에 글이 올라왔습니다.";
$link_url = "$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$wr_id&$qstr";


include_once("$g4[path]/lib/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);
}
}
?>
해보았는데 메일이 안오더군요 테스트메일이나 인증메일은 잘 작동되고 있습니다.

메일이 오게하려면 이 코드를 어디에 넣어야 하나요?

도와주세요

스킨링크
http://sir.co.kr/bbs/board.php?bo_table=g4_skin_board&wr_id=23254&sca=&sfl=wr_subject&stx=%BC%EE%C7%CE&sop=and










꼭!!!!
감사합니다.

첨부파일

shop_mall.zip (329.3 KB) 8회 2010-11-05 14:04
|

댓글 12개

올리신 소스를 토대로 설명드리자면..
foreach($emails as $email)
{
if ($email)
mailer($wr_name, $wr_email, $email, $subject, $content, 1);
}

상위 내용이 배열을 처리하여 메일을 보내도록 되어 있으므로..
흑금성님께서 잘못 이해하신 부분은 다음과 같습니다.

$emails[] = "<A href="mailto:test@test.com" target=_blank>test@test.com</A>"; // 이메일주소1
$emails[] = "<A href="mailto:test2@test.com" target=_blank>test2@test.com</A>"; // 이메일주소2
$emails[] = "<A href="mailto:test3@test.com" target=_blank>test3@test.com</A>"; // 이메일주소3
$emails[] = "<A href="mailto:test4@test.com" target=_blank>test4@test.com</A>"; // 이메일주소4
$emails[] = "<A href="mailto:test5@test.com" target=_blank>test5@test.com</A>"; // 이메일주소5
$emails[] = "<A href="mailto:test6@test.com" target=_blank>test6@test.com</A>"; // 이메일주소6

수정후
$emails[] = "test@test.com"; // 이메일주소1
$emails[] = "test2@test.com"; // 이메일주소2

또는
$emails[] = "테스트1<test@test.com>"; // 이메일주소1
$emails[] = "테스트2<test2@test.com>"; // 이메일주소2
code 를 씌우니까 글어온글에 링크가 생겼어요 ㅜㅜ

제가 확인 했어야하는데 죄송합니다.
ㅎㅎ 씹혔당..
order_u.php 파일에 넣으세요.

$sql = " INSERT INTO {$write_table}_order
SET mb_id = '$member[mb_id]',
wr_id = '$wr_id',
od_name = '$od_name',
od_qty = '$od_qty',
od_price = '$od_price',
od_total_price = '$od_total_price',
od_tel = '$od_tel',
od_hp = '$od_hp',
od_zip1 = '$od_zip1',
od_zip2 = '$od_zip2',
od_addr1 = '$od_addr1',
od_addr2 = '$od_addr2',
od_bank_use = '$od_bank_use',
od_memo = '$od_memo',
od_datetime = '$g4[time_ymdhis]' ";
sql_query($sql);

// 받을 사람의 이메일주소를 넣어주세요.
$emails[] = "test1@test.com"; // 이메일주소1
$emails[] = "test2@test.com"; // 이메일주소2
$emails[] = "test3@test.com"; // 이메일주소3
$emails[] = "test4@test.com"; // 이메일주소4
$emails[] = "test5@test.com"; // 이메일주소5
// 계속 추가할 수 있습니다.

$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 = "'{$board[bo_subject]}' 게시판에 글이 올라왔습니다.";
$link_url = "$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$wr_id&$qstr";

include_once("$g4[path]/lib/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);
}

alert("구매신청완료 되었습니다.","$g4[bbs_path]/board.php?bo_table=$bo_table");

?>
<?
include_once "_common.php";
//************************************************************
//
// 스킨명 : 카멜레온 간이몰 스킨
// 버 젼 : 2006-03-16일짜 버젼
// 제작자 : ⓒⓒⓒ (Soonho Choi) http://cm-builder.com
// MSN : oldccc@oldccc.com
//
// 저작권 : 이 주석 부분을 훼손하지 상태에서 수정및 사용이 자유롭습니다.
//
//************************************************************
//
// 스킨명 : 간이몰 스킨 1v
// 수 정 : 2006-07-29일
// 수정자 : 스펙트럼 (toptalent) http://spectrum-enter.com/YBH/
// E-mail : top-talent@hanmail.net
//
// 저작권 : 이 주석 부분을 훼손하지않은 상태에서 수정및 사용이 자유롭습니다.
//
//************************************************************

이거 아래부터 넣는거 맞죠?
근데 메일은 안오네요 그리고 테스트 메일 잘들어가면 메일에는 문제가 없는거 같은데 안되네요 ㅠㅠ
include_once ("./write_update_mail.php"); 어떤분이 경로문제 라고 하셔서
include_once ("$g4[url]/$g4[bbs]//write_update_mail.php");
include_once ("../../bbs/write_update_mail.php");
include_once ("$g4[path]/bbs/write_update_mail.php"); 이렇게 바꿔봤는데 ㅜㅜ
테스트 후 다시 올립니다. 메일이 정상적으로 발송되는것을 확인하였습니다.

order_u.php 파일입니다.

<?
include_once "_common.php";
//************************************************************
//
// 스킨명 : 카멜레온 간이몰 스킨
// 버 젼 : 2006-03-16일짜 버젼
// 제작자 : ⓒⓒⓒ (Soonho Choi) http://cm-builder.com
// MSN : oldccc@oldccc.com
//
// 저작권 : 이 주석 부분을 훼손하지 상태에서 수정및 사용이 자유롭습니다.
//
//************************************************************
//
// 스킨명 : 간이몰 스킨 1v
// 수 정 : 2006-07-29일
// 수정자 : 스펙트럼 (toptalent) http://spectrum-enter.com/YBH/
// E-mail : top-talent@hanmail.net
//
// 저작권 : 이 주석 부분을 훼손하지않은 상태에서 수정및 사용이 자유롭습니다.
//
//************************************************************

$sql = " INSERT INTO {$write_table}_order
SET mb_id = '$member[mb_id]',
wr_id = '$wr_id',
od_name = '$od_name',
od_qty = '$od_qty',
od_price = '$od_price',
od_total_price = '$od_total_price',
od_tel = '$od_tel',
od_hp = '$od_hp',
od_zip1 = '$od_zip1',
od_zip2 = '$od_zip2',
od_addr1 = '$od_addr1',
od_addr2 = '$od_addr2',
od_bank_use = '$od_bank_use',
od_memo = '$od_memo',
od_datetime = '$g4[time_ymdhis]' ";
sql_query($sql);

// 받을 사람의 이메일주소를 넣어주세요.
$emails[] = "test@nate.com"; // 이메일주소1
// 계속 추가할 수 있습니다.

$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]; // 보내는 사람 이름
$wr_email = $row[wr_email]; // 보내는 사람 이메일
$subject = "'{$board[bo_subject]}' 게시판에 글이 올라왔습니다."; // 메일 제목
$link_url = "$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$wr_id&$qstr";

include_once("$g4[path]/lib/mailer.lib.php");
ob_start();
include_once ("$g4[bbs_path]/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);
}

alert("구매신청완료 되었습니다.","$g4[bbs_path]/board.php?bo_table=$bo_table");

?>
여러개의 게시판에 orderlist.php 에 게시물들을 하나의게시판이나 최근 게시물로 불러올수는 없을까요?
방긋님 감사합니다.

아직 성공은 못했지만 그누 다시 셋업하고 시도해보겠습니다.

안되면 쪽지좀 받아주실수 있는지요 ?
성공했어요 감사합니다.
중때린수녀님도 감사합니다.
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
15년 전 조회 1,646
15년 전 조회 1,014
15년 전 조회 954
15년 전 조회 2,243
15년 전 조회 2,483
15년 전 조회 741
15년 전 조회 1,522
15년 전 조회 2,036
15년 전 조회 1,035
15년 전 조회 2,018
15년 전 조회 1,038
15년 전 조회 1,222
15년 전 조회 1,031
15년 전 조회 1,683
15년 전 조회 780
15년 전 조회 1,769
15년 전 조회 1,005
15년 전 조회 1,650
15년 전 조회 1,465
15년 전 조회 1,323
🐛 버그신고