1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
<?
/*//////////////////////////////////////////////////////////////////////////////////// // // ¸ÞÀÏÇì´õ // ////////////////////////////////////////////////////////////////////////////////////*/ $fromname = "=?EUC-KR?B?".base64_encode($sendname)."?="; $frommail = $sendmail; $content = stripslashes($content);
$boundary = "-------boundary_Mikishop_1_".md5(time()); $boundary2 = "-------boundary_Mikishop_2_".md5(time()); $boundary3 = "-------boundary_Mikishop_3_".md5(time());
//////////////////////////////////////////////////////////////////////////////////// // // attachment // //////////////////////////////////////////////////////////////////////////////////// $neko_file = split ("@", $_POST[neko_files]); $fileno = count ($neko_file);
$attcnt = -1; for ( $i = 0; $i < $fileno; $i++ ) { if ($neko_file[$i]) { $attcnt++;
$filen = $_neko[updir]."/".$neko_gr."/".$neko_file[$i]; $filename = basename($filen); $filesize = filesize($filen); $filetype = getimagesize ($filen); $filetype = ( $filetype[mime] ) ? $filetype[mime] : "application/octet-stream";
$read = fopen($filen, "r"); $file = fread($read, $filesize); fclose($read);
// ÷ºÎ $attachment[$attcnt] .= "Content-Type: $filetype;\r\n"; $attachment[$attcnt] .= " name=\"$filename\"\r\n"; $attachment[$attcnt] .= "Content-Transfer-Encoding: base64\r\n"; $attachment[$attcnt] .= "Content-Description: $filename\r\n"; $attachment[$attcnt] .= "Content-Disposition: attachment;\r\n"; $attachment[$attcnt] .= " filename=\"$filename\"\r\n\r\n"; $attachment[$attcnt] .= chunk_split (base64_encode($file))."\r\n"; } } $attcnt++;
//////////////////////////////////////////////////////////////////////////////////// // // »ðÀÔµÈ À̹ÌÁö ó¸® // //////////////////////////////////////////////////////////////////////////////////// $neko_related = eregi_replace ("^@|@$", "", $neko_related); $relatedobj = split ("@", $neko_related); $relatedno = count ($relatedobj); if ( !$relatedobj[0] ) $relatedno = 0;
$relcnt = -1;
for ($i = 0; $i < $relatedno; $i++) {
$file = rawurldecode($relatedobj[$i]); $basename = basename($file); $cid = "related_".md5($basename);
if ( strstr ($content, $relatedobj[$i]) ) { // º»¹®¿¡ Related µÈ À̹ÌÁö°¡ ÀÖÀ»°æ¿ì $relcnt++; $content = str_replace ($relatedobj[$i], "cid:$cid", $content);
$file = str_replace ($_neko[upurl], $_neko[updir], $file); $relateinfo = getimagesize ($file); $filesize = filesize ($file); $mime = $relateinfo[mime];
$read = fopen($file, "r"); $file = fread($read, $filesize); fclose($read);
$related[$relcnt] .= "Content-Type: $mime;\r\n"; $related[$relcnt] .= " name=\"$basename\"\r\n"; $related[$relcnt] .= "Content-Disposition: inline;\r\n"; $related[$relcnt] .= " filename=\"$basename\"\r\n"; $related[$relcnt] .= "Content-ID: <$cid>\r\n"; $related[$relcnt] .= "Content-Transfer-Encoding: base64\r\n\r\n"; $related[$relcnt] .= chunk_split (base64_encode($file))."\r\n"; } } $relcnt++;
/*//////////////////////////////////////////////////////////////////////////////////// // // ¸ÞÀÏ ·çÇÁ // ////////////////////////////////////////////////////////////////////////////////////*/
$body_html .= "Content-Type: text/html;\r\n"; $body_html .= " charset=euc-kr\r\n"; $body_html .= "Content-Transfer-Encoding: base64\r\n\r\n"; $body_html .= chunk_split (base64_encode($_content))."\r\n\r\n";
/*//////////////////////////////////////////////////////////////////////////////////// // // ¸ÞÀÏÁ¾·ù ¾Ë¾Æ³»±â~ // ////////////////////////////////////////////////////////////////////////////////////*/ if ( $body_plain ) $mailtype = 1; if ( $body_html ) $mailtype = 2; if ( $attachment ) $mailtype = 3; if ( $related ) $mailtype = 4; if ( $related && $attachment ) $mailtype = 5;
switch ( $mailtype ) { case 1 : // TEXT ¸ÞÀÏ $mailtype = "text/plain";
$bodytext .= "--$boundary\r\n"; $bodytext .= $body_plain; $bodytext .= "\r\n--$boundary--"; break;
case 2 : // HTML ¸ÞÀÏ $mailtype = "multipart/alternative";
$bodytext .= "--$boundary\r\n"; $bodytext .= $body_plain; $bodytext .= "--$boundary\r\n"; $bodytext .= $body_html; $bodytext .= "--$boundary--";
break;
case 3 : // ÷ºÎÆÄÀÏ $mailtype = "multipart/mixed";
$bodytext .= "--$boundary\r\n"; $bodytext .= "Content-Type: multipart/alternative;"; $bodytext .= " boundary=\"".$boundary2."\""."\r\n\r\n"; $bodytext .= "--$boundary2\r\n"; $bodytext .= $body_plain; $bodytext .= "--$boundary2\r\n"; $bodytext .= $body_html; $bodytext .= "--$boundary2--\r\n\r\n";
for ( $i = 0; $i < $attcnt; $i++) { $bodytext .= "--$boundary\r\n"; $bodytext .= $attachment[$i]; }
$bodytext .= "\r\n--$boundary--"; break;
case 4 : // »ðÀÔ À̹ÌÁö $mailtype = "multipart/alternative";
$bodytext .= "--$boundary\r\n"; $bodytext .= $body_plain; $bodytext .= "--$boundary\r\n"; $bodytext .= "Content-Type: multipart/related;"; $bodytext .= " boundary=\"".$boundary2."\""."\r\n\r\n"; $bodytext .= "--$boundary2\r\n"; $bodytext .= $body_html;
for ( $i = 0; $i < $relcnt; $i++) { $bodytext .= "--$boundary2\r\n"; $bodytext .= $related[$i]; }
$bodytext .= "--$boundary2--\r\n\r\n"; $bodytext .= "--$boundary--"; break;
case 5 : // »ðÀÔ À̹ÌÁö + ÷ºÎÆÄÀÏ $mailtype = "multipart/mixed";
$bodytext .= "--$boundary\r\n"; $bodytext .= "Content-Type: multipart/alternative;"; $bodytext .= " boundary=\"".$boundary2."\""."\r\n\r\n"; $bodytext .= "--$boundary2\r\n"; $bodytext .= $body_plain; $bodytext .= "--$boundary2\r\n"; $bodytext .= "Content-Type: multipart/related;"; $bodytext .= " boundary=\"".$boundary3."\""."\r\n\r\n"; $bodytext .= "--$boundary3\r\n"; $bodytext .= $body_html;
for ( $i = 0; $i < $relcnt; $i++) { $bodytext .= "--$boundary3\r\n"; $bodytext .= $related[$i]; }
$bodytext .= "--$boundary3--\r\n\r\n"; $bodytext .= "--$boundary2--\r\n\r\n";
for ( $i = 0; $i < $attcnt; $i++) { $bodytext .= "--$boundary\r\n"; $bodytext .= $attachment[$i]; } $bodytext .= "\r\n--$boundary--"; break; }
$headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: $mailtype;\r\n"; $headers .= " boundary=\"$boundary\"\r\n"; $headers .= "To : <".$email.">\r\n"; $headers .= "From : ".$fromname." <".$frommail.">\r\n"; $headers .= "Reply-To: ".$fromname." <".$frommail.">\r\n";
$mailok = mail($email, $_subject, $bodytext, $headers);
$count ++;
unset ($body_plain, $body_html, $headers, $bodytext);
if ( $mailok ) $sendlist .= "<li>¡á <b>$c_name</b> ($user_id) - $email :: ¸ÞÀÏÀ» ¹ß¼ÛÇß½À´Ï´Ù</li>"; else $sendlist .= "<li>¡á <b>$c_name</b> ($user_id) - $email :: ¸ÞÀÏÀü¼ÛÀÌ ½ÇÆÐµÇ¾ú½À´Ï´Ù</li>";
//////////////////////////////////////////////////////////////////////////////////// // // °á°ú Ãâ·Â // //////////////////////////////////////////////////////////////////////////////////// ?> <div style='padding:5px;color:#FFFFFF; background:#028196;'> <B class='yellow_b'>¢Æ</B> ¸ÞÀÏ ¹ß¼Û °á°ú </div>
<table id="orangeWriter" width="100%" cellpadding="0" cellspacing="0"> <col width='120'><col width=''> <tr> <td> <ul class="mailresult"> <?=$sendlist?> </ul> </td> </tr> </table>
<div style="padding: 5px;"> <img src="<?=$_miki[urlroot]?>/image/icon/ic_arrow.gif" align="absmiddle"> ÃÑ <b style="color: red"><?=$count?></b> ÅëÀÇ ¸ÞÀÏÀÌ ¹ß¼ÛµÇ¾ú½À´Ï´Ù <a href="?sub=mail"><img src="/image/button/bt_list.gif" class="bt_ok" align="absmiddle"></a> </div>
|