전체 메일 보낼 때, 파일 첨부하기 정보
전체 메일 보낼 때, 파일 첨부하기본문
관리하는 사이트가
회원들에게 전체 메일을 보낼 때, 파일 첨부해야 할 경우가 많아서
만들어 봤던 건데, 간단한 것이지만 혹시 저말고
다른 분도 쓸모가 있을까 해서 올립니다.
파일 첨부는 디비를 사용하지 않고, 회원 선택 다하고
회원 메일 나열되는 곳에서 첨부하여 보내집니다.
먼저
------------------------------------------------------
bbs/adm/mail_select_list.php
------------------------------------------------------
113번째 줄 정도에 다음 문구
<textarea name="ma_list" style="display:none"><?=$ma_list?></textarea>
다음에
<input type="hidden" name="attach" value="2">
첨부파일 #1 : <input type=file style='width:80%;' name='file1'><br>
첨부파일 #2 : <input type=file style='width:80%;' name='file2'>
위 소스를 추가합니다.
------------------------------------------------------
bbs/adm/mail_select_update.php
------------------------------------------------------
36번째줄 정도에 다음 문구
//print_r2($_POST); EXIT;
$member_list = explode("\n", $select_member_list);
다음에
// 첨부파일이 있을때
for ($i=1; $i<=$attach; $i++)
{
if ($_FILES["file".$i][name])
$file[] = attach_file($_FILES["file".$i][name], $_FILES["file".$i][tmp_name]);
}
위 소스를 추가합니다.
75번째줄 다음 문구를
mailer($config[cf_title], $member[mb_email], $email, $subject, $content, 1);
mailer($config[cf_title], $member[mb_email], $email, $subject, $content, 1, $file);
로 수정합니다.
------------------------------------------------------
이상입니다.
덧붙임 : 첨부할 갯수를 늘리려면, mail_select_list 화일에서 input name값만 file3, file4 이런식으로 추가후, attach value값을 갯수만큼 주시면 됩니다.
회원들에게 전체 메일을 보낼 때, 파일 첨부해야 할 경우가 많아서
만들어 봤던 건데, 간단한 것이지만 혹시 저말고
다른 분도 쓸모가 있을까 해서 올립니다.
파일 첨부는 디비를 사용하지 않고, 회원 선택 다하고
회원 메일 나열되는 곳에서 첨부하여 보내집니다.
먼저
------------------------------------------------------
bbs/adm/mail_select_list.php
------------------------------------------------------
113번째 줄 정도에 다음 문구
<textarea name="ma_list" style="display:none"><?=$ma_list?></textarea>
다음에
<input type="hidden" name="attach" value="2">
첨부파일 #1 : <input type=file style='width:80%;' name='file1'><br>
첨부파일 #2 : <input type=file style='width:80%;' name='file2'>
위 소스를 추가합니다.
------------------------------------------------------
bbs/adm/mail_select_update.php
------------------------------------------------------
36번째줄 정도에 다음 문구
//print_r2($_POST); EXIT;
$member_list = explode("\n", $select_member_list);
다음에
// 첨부파일이 있을때
for ($i=1; $i<=$attach; $i++)
{
if ($_FILES["file".$i][name])
$file[] = attach_file($_FILES["file".$i][name], $_FILES["file".$i][tmp_name]);
}
위 소스를 추가합니다.
75번째줄 다음 문구를
mailer($config[cf_title], $member[mb_email], $email, $subject, $content, 1);
mailer($config[cf_title], $member[mb_email], $email, $subject, $content, 1, $file);
로 수정합니다.
------------------------------------------------------
이상입니다.
덧붙임 : 첨부할 갯수를 늘리려면, mail_select_list 화일에서 input name값만 file3, file4 이런식으로 추가후, attach value값을 갯수만큼 주시면 됩니다.
추천
1
1
댓글 10개

감사합니다. ^^ 스크랩!!
감사히 쓰겠습니다.
좋습니다.
감사합니다.
빠진부분이 있어서요.
adm/mail_select_list.php 에
92번라인에
<form name=fmailselectlist method=post action="javascript:fmailselectlist_submit(document.fmailselectlist);" enctype="multipart/form-data">
로 수정하셔야 파일이 첨부되겠는데요.
빠진부분이 있어서요.
adm/mail_select_list.php 에
92번라인에
<form name=fmailselectlist method=post action="javascript:fmailselectlist_submit(document.fmailselectlist);" enctype="multipart/form-data">
로 수정하셔야 파일이 첨부되겠는데요.
위에 form값으로 하니, true 에러가;;
이걸로 하시면 하단에
<form name=fmailselectlist method=post onsubmit="return fmailselectlist_submit(this);" enctype='multipart/form-data'>
Warning: fread(): Length parameter must be greater than 0. in /home/hosting_users/localdb/www/lib/mailer.lib.php on line 77
이런에러가 나네요;; 멀로 해야 하는건지;
이걸로 하시면 하단에
<form name=fmailselectlist method=post onsubmit="return fmailselectlist_submit(this);" enctype='multipart/form-data'>
Warning: fread(): Length parameter must be greater than 0. in /home/hosting_users/localdb/www/lib/mailer.lib.php on line 77
이런에러가 나네요;; 멀로 해야 하는건지;
오옷 감사합니다. !!
(이글이글이글님께서 적으신거 적용 안해도 됩니다.)
(이글이글이글님께서 적으신거 적용 안해도 됩니다.)

adm/mail_select_list.php 에
<form name=fmailselectlist method=post onsubmit="return fmailselectlist_submit(this);" enctype='multipart/form-data'>
enctype='multipart/form-data' 이게 첨부파일보낼때 있어야 하거든요~
이걸로 수정해야 적용되네요
<form name=fmailselectlist method=post onsubmit="return fmailselectlist_submit(this);" enctype='multipart/form-data'>
enctype='multipart/form-data' 이게 첨부파일보낼때 있어야 하거든요~
이걸로 수정해야 적용되네요
멋진 팁입니다.
감사합니다. 찾고있었던 자료인데 잘쓰겠습니다.
감사합니다.