/home/mjc1/public_html/emillennium/statement.email.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
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
<?php
$dir 
".";
include_once(
$dir."/_common.php");
include(
"include/header.sub.php");

if(
$midx_list=='' || $file_name==''){
    echo 
"<script>
                alert('파라메터값이 정상적이지 않습니다.');
                window.history.go(-1);
            </script>
    "
;
    exit;
}

$sql "select * from user_config where menu_name = 'EmailOptionWindow' "// 메일설정의 내용을 가져온다.
$res mysql_query($sql,$connect_e1000y);
while(
$minfo mysql_fetch_array($res)){
    if(
$minfo['config_key']=='메일서버정보_보내는사람주소'){ $uc_email $minfo['config_val']; }
}

$sql "select * from offices where code = 1 ";
$res mysql_query($sql,$connect_e1000y);
while(
$minfo mysql_fetch_array($res)){
    
$code $minfo['code'];
    
$comp_sn $minfo['comp_sn'];
    
$telno1 $minfo['telno1'];
    
$hpno $minfo['hpno'];
    
$faxno $minfo['faxno'];
    
$sub_comp_sn $minfo['sub_comp_sn'];
    
$biz_status $minfo['biz_status'];
    
$biz_item $minfo['biz_item'];
    
$comp_name $minfo['comp_name'];
    
$ceo_name $minfo['ceo_name'];
    
$zipcode $minfo['zipcode'];
    
$addr_m $minfo['addr_m'];
    
$addr_d $minfo['addr_d'];
    
$email $minfo['email'];

    
$tax_charge_name $minfo['tax_charge_name'];
    
$tax_charge_hpno $minfo['tax_charge_hpno'];
    
$tax_charge_email $minfo['tax_charge_email'];

    
$buy_array[] = $minfo;
}

$sql "select b.comp_name, b.ceo_name, b.email
    from sale_m a left join customers b on a.ccode = b.code
  where a.midx in (
{$midx_list}) group by a.ccode";
$res mysql_query($sql,$connect_e1000y);
while(
$cinfo mysql_fetch_array($res)){
    
$r_ceo_name $cinfo['ceo_name'];
    if(
$r_ceo_name=='') { $r_ceo_name $cinfo['comp_name']; }
    
$r_email $cinfo['email'];
}

$sql "select * from user_config where menu_name = 'EmailOptionWindow' "// 메일설정의 내용을 가져온다.
$res mysql_query($sql,$connect_e1000y);
while(
$minfo mysql_fetch_array($res)){
    if(
$minfo['config_key']=='메일서버정보_SMTP'){ $uc_smtp $minfo['config_val']; }
    if(
$minfo['config_key']=='메일서버정보_포트번호'){ $uc_port $minfo['config_val']; }

    if(
$minfo['config_key']=='메일서버정보_사용자_ID'){ $uc_id $minfo['config_val']; }
    if(
$minfo['config_key']=='메일서버정보_패스워드2'){ 
        
$uc_pw $minfo['config_val']; 
        
$uc_pw decrypt($uc_pw,"m.j.s.f.t"); // 암호 푼다.
    
}
}
if(
$uc_id=='' || $uc_pw==''){
    
$smtp_idpw "N";
}
?>

<form name='statement_email_form' method='post' action='statement.email.send.php' enctype="multipart/form-data">
<input type='hidden' name='qstr' value=''>
<input type='hidden' name='midx_list' value='<?php echo $midx_list;?>'>
<input type='hidden' name='file_name' value='<?php echo $file_name;?>'>
    <div id="sub-contents-area">
        <div class="sub-btn-area">
            <div class="sub-btn pop-btn" style='padding-left:250px;'>
                <a class="gray-btn" id='btn_state_email4'>메일전송</a><a class="black-btn" id='mail_close'>취소</a>
            </div>
        </div>
    </div>

<div class='cust_modal1'>
    <h4>이메일 설정</h4>
    <table class="order-sheet table-top-border">
        <caption class="screen_out">이메일 설정</caption>
        <colgroup>
            <col style="width:100px;"><col style="width:230px;">
            <col style="width:100px;"><col style="width:230px;">
        </colgroup>

        <tbody>
        <tr>
            <th>보내는 사람 명</th>
            <td colspan=3>
                <input type='text' name='send_name' value='<?php echo $comp_name;?>'>
            </td>
        </tr>
        <tr>
            <th>보내는 사람 메일</th>
            <td colspan=3>
                <input type='text' name='send_email' value='<?php echo $uc_email;?>' class='input_readonly'> ※ 변경 불가. 필요시 기초등록 메일설정에서 수정
            </td>
        </tr>
        <tr>
            <th>받는 사람 명</th>
            <td colspan=3>
                <input type='text' name='recv_name' value='<?php echo $r_ceo_name;?>'>
            </td>
        </tr>
        <tr>
            <th>받는 사람 메일</th>
            <td colspan=3>
                <input type='text' name='recv_email' value='<?php echo $r_email;?>'>
            </td>
        </tr>
        <tr>
            <th>메일 제목</th>
            <td colspan=3>
                <input type='text' name='email_subject' value=''>
            </td>
        </tr>
        <tr>
            <th>메일 내용</th>
            <td colspan=3>
                <textarea name='email_content' style='width:400px;height:100px;'></textarea>
            </td>
        </tr>
        <tr>
            <th>거래명세표</th>
            <td colspan=3>
                <?php echo $file_name;?> <a href='./tmp/<?php echo $file_name;?>' target='_blank'>[다운로드]</a>
            </td>
        </tr>
        <tr>
            <th>첨부파일</th>
            <td colspan=3>
                <input type='file' name='add_file1'><br>
                <input type='file' name='add_file2'>
            </td>
        </tr>
    </table>
    <br>
     <!--<span style='color:red;font-weight:bold;'>※ 전송오류메시지에 따른 필수 확인 사항 <a id='smtp_error'>[확인하기]</a>.</span>-->
</div>

</form>
<script>
$(function(){

    $("#smtp_error").click(function(){
        $("#modal_member_box").dialog({
            resizable: true, height:400, width:540, modal: true, title: "전송오류내용 [필독사항]",
            buttons: {
                닫기: function() {
                    $( this ).dialog( "close" );
                }
            }
        });
    });

    $("#mail_close").click(function(){
        window.close();    
    });

    $("#btn_state_email4").click(function(){
        if('<?php echo $smtp_idpw;?>'=='N'){
            alert('메일설정의 이메일 아이디나, 이메일 비밀번호가 설정되지 않았습니다. 기초등록->메일설정에서 등록하시기 바랍니다.'); return;
        }

        $form = $("form[name='statement_email_form']");
        if($("input[name='send_email']").val()==''){
            alert('보내는 사람 이메일을 입력하세요. 해당항목은 이곳에서 변경불가이므로 기초등록 메일설정에서 이메일을 수정하시면 됩니다.');
            return;
        }
        if($("input[name='recv_email']").val()==''){
            alert('받는 사람 이메일을 입력하세요.');
            return;
        }
        if($("input[name='email_subject']").val()==''){
            alert('메일 제목을 입력하세요.');
            return;
        }
        if(confirm('정말로 메일을 발송하시겠습니까? \n 전송이 안될경우 아래 전송오류 메시지 내용을 확인 하시기 바랍니다.')){
            $form.submit();
        }
    });
    window.resizeTo(750,550);    
});
</script>
<div id="modal_member_box" title="1차모달" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;line-height:22px;">
1. 
</div>