/home/mjc1/public_html/manage/sendmailpro4process.php


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
<?php

@extract($_REQUEST);





Function 
AddAttachment($message$name ""$ctype "application/octet-stream"){
    return 
$Parts = array (
                     
"ctype" => $ctype,
                     
"message" => $message,
                     
"encode" => $encode,
                     
"name" => $name
                    
);

}

Function 
BuildMessage($part){

$message $part["message"]; 
$message chunk_split(base64_encode($message));
$encoding "base64";
return 
"Content-Type: ".$part["ctype"].
(
$part["name"]? "; name = \"".$part"name"]. "\"" "").
"\nContent-Transfer-Encoding: $encoding\n\n$message\n";

}

Function 
BuildMultiPart($Parts) {
    
    
$boundary "b".md5(uniqid(time()));
//    $multipart .= "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME 
    
$multipart .= "Content-Type: multipart/related; boundary = $boundary\n\nThis is a MIME 

        

    encoded 
    message.\n\n--
$boundary";

    for(
$i sizeof($Parts)-1$i >= 0$i--){
         
$multipart .= "\n".BuildMessage($Parts[$i])."--$boundary";
    }
    return 
$multipart.= "--\n";
}

Function 
Send($Html$To$Subject$Body$FormHearder$File$File_name$File_type){

    if(
$File_name!=""$Attachment fread(fopen($File"rb"), filesize($File)); 

    
$Hearders $FormHearder;

    
$Parts[] = AddAttachment($Body"""text/html");
    if(
$File_name!=""$Parts[] = AddAttachment($Attachment$File_name$File_type);

    
$Hearders .= "MIME-Version: 1.0\n";

    for(
$i 0$i sizeof($Parts); $i++) $Hearders .= BuildMultiPart($Parts); 
    @
mail($To$Subject""$Hearders);
}


$Fromheader"From: $Name <".$Sender.">\r\n";
$Returnheader "Return-Path: ".$Sender."\r\n";
$Errhearderr "Errors-To: ".$Sender."\r\n";


$Hearders $Fromheader.$Returnheader.$Errhearderr;
$Toheader"To: $Uname <".$Receiver.">\r\n";

//$Html = 0; //html
$Html 1//ÀÏ¹Ý ÅØ½ºÆ®

if($Html == 1){ /* ÅؽºÆ® ÀÏ °æ¿ì */

    
$Body htmlspecialchars($Body);
    
$Body stripslashes($Body);
    
$Body str_replace(" ""&nbsp;",$Body);
    
$Body nl2br($Body);

        
$Body $Body."<br><br><br>"."ÇÁ·Î±×·¥ µµÀÔ ¹®ÀÇ : ¹ÌÁø¼ÒÇÁÆ®(1566-8680)";

}else{

    
$Body stripslashes($Body); /* HTML ÀÏ °æ¿ì */

        
$Body $Body."<br><br><br>"."ÇÁ·Î±×·¥ µµÀÔ ¹®ÀÇ : ¹ÌÁø¼ÒÇÁÆ®(1566-8680)";

}        

$Body stripslashes($Body);
if(
$Mode){
    

Send($Html$Toheader$Subject$Body$Hearders$File$File_name$File_type);

  echo
"<br><b><center>º¸³»´ÂÁß......</center>
    <meta http-equiv='refresh' content='3;url=sendmailpro4.php'>    
    "
;
}


?>