Add: sendMailRegistered, mail php

This commit is contained in:
2018-09-19 11:22:36 +09:00
parent 697265ee29
commit bffc63996a
11 changed files with 300 additions and 175 deletions
+56 -20
View File
@@ -15,10 +15,59 @@
$("#header").load("admin_header.html");
});
function sendMail() {
function getMaestroData() {
var maestroID = 1;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/mail/testmail.php",
"maestro_id=" + maestroID,
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=get_maestro_data" + "&maestro_id=" + maestroID,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailBankInfo() {
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailBankInfo" + "&maestro_name=" + maestroName + "&email=" + email + "&account_type=" + accountType,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailRegistered() {
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailRegistered" + "&maestro_name=" + maestroName + "&email=" + email + "&account_type=" + accountType,
function(jsonData) {
console.log(jsonData);
@@ -49,25 +98,12 @@
<div id="message_box"></div>
<button type="button" class="btn btn-primary" onClick="sendMail()">메일 발송</button>
<button type="button" class="btn btn-primary" onClick="sendMailBankInfo()">[ 마에 ] 입금 계좌 안내 메일 발송</button>
<!--
<div class="row mx-1">
<div class="col">
<h5 class="my-3">마에스트로 검색</h5>
<button type="button" class="btn btn-primary" onClick="sendMailRegistered()">[ 마에 ] 등록 완료 메일 발송</button>
<button type="button" class="btn btn-secondary" onClick="getMaestroData()">마에스트로 데이터 테스트</button>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="search_name">마에스트로 아이디</label>
</div>
<input type="text" class="form-control" id="search_name" placeholder="Input maestro ID here" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<button type="button" class="btn btn-primary" onClick="searchMaestro()">검색 실행</button>
</div>
</div>
</div>
</div>
-->
</div> <!-- container -->
+1 -1
View File
@@ -7,7 +7,7 @@
</div>
<div class="col-md pt-1 text-center my-auto">
<label>문의 : support@jinaju.com</label>
<label>문의 : support+chocomae@jinaju.com</label>
</div>
<div class="col-md-4 text-right my-auto">
+19 -28
View File
@@ -89,7 +89,7 @@ function checkData() {
}
password = $("#password").val();
console.log("password : " + password);
// console.log("password : " + password);
if(password.length === 0) {
showErrorMessage("암호를 입력해 주세요.", "error");
$("#password").focus();
@@ -108,7 +108,7 @@ function checkData() {
selectedAccountTypeValue = $("#account_type").val();
// selectedAccountTypeText = $("#account_type option:selected").text();
console.log(selectedAccountTypeValue);
// console.log(selectedAccountTypeValue);
// console.log(selectedAccountTypeText);
let isCheckAcceptClauses = $("#check_accept_clauses").is(":checked");
@@ -200,7 +200,7 @@ function register_account() {
}
$('#myTab a').on('click', function (e) {
e.preventDefault()
e.preventDefault();
// $(this).tab('show')
})
@@ -326,22 +326,21 @@ $('#myTab a').on('click', function (e) {
<div class="row">
<label class="col-sm-2 col-form-label">* 이메일</label>
<label class="col-sm-9 col-form-label"><span class="email_data">???</span></label>
<label class="col-sm-9 col-form-label"><span class="email_data text-primary">???</span></label>
</div>
<div class="row">
<label class="col-sm-2 col-form-label">* 학생 수</label>
<label class="col-sm-9 col-form-label"><span class="player_count">???</span> (<span class="price_account">???</span> / 1년)</label>
<label class="col-sm-9 col-form-label"><span class="player_count text-primary">???</span> (<span class="price_account text-primary">???</span> / 1년)</label>
</div>
</form>
<div class="mb-4">
위의 내용이 모두 맞는지 확인해주세요.<br/>
아래의 등록 신청 버튼을 누르면, 입력하신 이메일 주소로도 입금 내용을 보내드립니다.<br/>
입력하신 내용이 모두 맞는지 확인해주세요.<br/>
</div>
<button class="btn btn-primary btn-block btn-lg" onClick="register_account()">계정 신청</button>
<button class="btn btn-primary btn-block btn-lg" onClick="register_account()">계정 등록</button>
</div>
</div> <!-- 신청 정보 확인 -->
@@ -355,10 +354,12 @@ $('#myTab a').on('click', function (e) {
<p>마에스트로 아이디 <span class="maestro_name_data text-primary font-weight-bold">????</span> 가 신청되었습니다.</p>
<div>
방금 <span class="email_data text-primary font-weight-bold"></span> 메일로 입금 안내 내용을 보내드렸습니다.
</div>
<ul>
<li>지금 보고 계신 내용을 등록하신 <span class="email_data text-primary font-weight-bold">????</span> 메일로 보냈습니다.<br/>
그런데 네이버/다음 메일 등에서 [초코 마에] 메일이 [스팸 메일함]로 들어가고 있네요.</li>
<li><span class="font-weight-bold text-danger">번거로우시겠지만 네이버/다음 메일의 [스팸 메일함]에서 해당 메일을 [스팸 해제] 처리 부탁드립니다.</span><br/>
([계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 이후에 발송될 예정입니다)</li>
</ul>
</div>
<div class="px-5 py-4 my-3" style="background-color: #ffce54">
@@ -367,7 +368,7 @@ $('#myTab a').on('click', function (e) {
<form class="mx-4">
<div class="row">
<label class="col-sm-3 col-form-label">* 카카오뱅크</label>
<label class="col-sm-9 col-form-label">(박지상) 3333-04-4316912</label>
<label class="col-sm-9 col-form-label">3333-04-4316912 (예금주 : 박지상)</label>
</div>
<div class="row">
@@ -378,7 +379,7 @@ $('#myTab a').on('click', function (e) {
<div class="row">
<label class="col-sm-3 col-form-label">* 송금자명</label>
<div class="col-sm-9">
<label class="col-form-label"><span class="maestro_name_data text-primary font-weight-bold"></span> (로 입력해주세요)</label>
<label class="col-form-label"><span class="maestro_name_data text-primary font-weight-bold"></span> (신청하신 마에스트로 아이디)</label>
<small class="form-text text-muted">빠른 입금 확인과 계정 활성화를 위해, 송금자명을 아이디로 입력 부탁드립니다.</small>
</div>
</div>
@@ -386,23 +387,13 @@ $('#myTab a').on('click', function (e) {
</div>
<div class="px-5 py-4 my-3" style="background-color: #ffdddd">
<h4>스팸 메일 확인 요청</h4>
<ul>
<li>support@jinaju.com 이 발송하는 메일이 네이버/다음 메일 등에서 [스팸 메일함]에 들어가는 것으로 확인되었습니다.</li>
<li>번거로우시겠지만 [스팸 메일함]에서 해당 메일을 스팸 해제 처리 부탁드립니다.</li>
</ul>
</div>
<div class="px-5 py-4 my-3" style="background-color: #ffdddd">
<div class="px-5 py-4 my-3" style="background-color: #ddffff">
<h4>계정 활성화 안내</h4>
<ul>
<li>계정 신청 내역과 입금 내역 확인한 후, 바로 마에스트로 아이디를 활성화겠습니다.</li>
<li>신청후 24시간 안에 확인하고 활성화하도록 노력하겠습니다.</li>
<li>계정 등록 절차가 완료되는대로, 활성화되었음을 알리는 메일을 드리겠습니다.</li>
<li>입금 내역 확인되는대로 마에스트로 아이디를 활성화 해드리겠습니다.</li>
<li>현재 수작업으로 확인하고 계정을 활성화하고 있어서 시간이 조금 걸리고 있습니다. 양해 부탁드립니다.</li>
<li>마에스트로 계정이 활성화되는대로 즉시 알림 메일을 드리겠습니다.</li>
</ul>
</div>
@@ -3,6 +3,10 @@ header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
include "./../lib/maestro_account_info.php";
include "./../lib/db_maestro.php";
include "./../mail/mail_setting.php";
include "./../mail/send_mail.php";
$maestroID = $_POST["maestro_id"];
@@ -35,6 +39,8 @@ add_maestro_sample_player_data($maestroID);
$count = count_registered_player($maestroID);
update_count_registered_player($maestroID, $count);
$maestro_data = get_maestro_data($maestroID);
sendMailRegistered($maestro_data["name"], $maestro_data["email"]);
send_result_success();
exit;
+31
View File
@@ -0,0 +1,31 @@
<?php
function get_maestro_data($maestro_id) {
global $db_conn;
$query = "
SELECT Name, Email, AccountType, ActivateStatus, AvailableActivateDateTime, PlayerCount, AcceptClausesDateTime, MaestroTestID
FROM maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->bind_result($name, $email, $accountType, $activateStatus, $availableActivateDateTime, $playerCount, $acceptClausesDateTime, $maestroTestID);
$stmt->fetch();
$stmt->close();
$maestro_data = array();
$maestro_data['name'] = $name;
$maestro_data['email'] = $email;
$maestro_data['accountType'] = $accountType;
$maestro_data['activateStatus'] = $activateStatus;
$maestro_data['availableActivateDateTime'] = $availableActivateDateTime;
$maestro_data['playerCount'] = $playerCount;
$maestro_data['acceptClausesDateTime'] = $acceptClausesDateTime;
$maestro_data['maestroTestID'] = $maestroTestID;
return $maestro_data;
}
?>
@@ -1,23 +0,0 @@
<?php
function get_max_player_count($accountType) {
switch($accountType) {
case 0:
case 1:
case 100:
case 101:
return 20;
case 2:
return 50;
case 3:
return 100;
case 4:
return 500;
case 5:
return 1000;
}
return 0;
}
?>
+6 -11
View File
@@ -1,22 +1,16 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
include "./../lib/send_reply_json.php";
include "./../lib/maestro_account_info.php";
include "./../mail/mail_setting.php";
include "./../mail/send_mail.php";
$maestro_name = $_POST["maestro_name"];
$password = $_POST["password"];
$email = $_POST["email"];
$account_type = $_POST["account_type"];
/*
if(!is_numeric($enterCode)) {
send_error_code("생년월일이 숫자가 아닙니다. : ".$enterCode);
exit;
} else if(strlen($enterCode) != 6) {
send_error_code("6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : ".$enterCode);
exit;
}
*/
$maestroID = has_maestro_name($maestro_name);
@@ -35,7 +29,8 @@ if($maestroID === null) {
exit;
}
set_data("maestroList", $maestroList);
sendMailBankInfo($maestro_name, $email, $account_type);
send_result_success();
exit;
+7 -5
View File
@@ -1,11 +1,13 @@
<?php
$newLine = "\r\n";
$new_line = "\r\n";
$from = "support+chocomae@jinaju.com";
$bcc = "support+chocomae.automail@jinaju.com";
// load service db setting
$bankName = "카카오뱅크";
$bankOwnerName = "박지상";
$bankAccountNo = "3333-04-4316912";
$bank_name = "카카오뱅크";
$bank_owner_name = "박지상";
$bank_account_no = "3333-04-4316912";
?>
+117
View File
@@ -0,0 +1,117 @@
<?php
////////////////////////////////////////
// 마에스트로 계정 신청 - 입금 안내
function sendMailBankInfo($maestro_name, $mail_to, $account_type) {
global $from, $bcc;
header("Content-Type: text/html; charset=UTF-8");
// $subject = subjectInfoBankAccountForRegisteringMaestro($maestro_name);
// $message = messageInfoBankAccountForRegisteringMaestro($maestro_name, $account_type);
// $header = "From:".$from.$new_line."BCC:".$bcc;
// mb_send_mail($mail_to, $subject, $message, $header);
mb_send_mail(
$mail_to,
subjectBankInfo($maestro_name),
messageBankInfo($maestro_name, $account_type),
makeMailHeader($from, $bcc)
);
header("Content-Type: application/json");
}
function subjectBankInfo($maestro_name) {
return "[초코마에] 마에스트로 계정 (".$maestro_name.") 등록을 위한 입금 안내";
};
function messageBankInfo($maestro_name, $account_type) {
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
return "안녕하세요.".$new_line."[초코마에] 마에스트로 계정을 신청해 주셔서 감사합니다.".$new_line
.$new_line
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$new_line
.$new_line
.$new_line
."[".$maestro_name."] 마에스트로 계정을 활성화 하기 위한 은행 계좌 정보는 아래와 같습니다.".$new_line
."------------------------------------------------------------".$new_line
." * 은행 계좌 : ".$bank_account_no." ( ".$bank_name." )".$new_line
." * 예금주명 : ".$bank_owner_name.$new_line
." * 금액 : ".get_price($account_type)."".$new_line
.$new_line
." * 송금자명 : ".$maestro_name." (신청하신 마에스트로 아이디)".$new_line
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$new_line
."------------------------------------------------------------".$new_line
.$new_line
."* 계정이 활성화되면 1년동안 사용하실 수 있습니다.".$new_line
."* 연장 결제를 해주시면, 남은 기간에 1년이 추가됩니다.".$new_line
."* 상위 요금제로 업그레이드 하셔도, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
.$new_line
.$new_line
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 활성화 해드리겠습니다.".$new_line
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$new_line
."마에스트로 계정이 활성화되는대로, 즉시 알림 메일을 드리겠습니다.".$new_line
.$new_line
."감사합니다.".$new_line;
}
////////////////////////////////////////
// 마에스트로 계정 활성화 안내
function sendMailRegistered($maestro_name, $mail_to) {
global $from, $bcc;
header("Content-Type: text/html; charset=UTF-8");
// $subject = subjectInfoBankAccountForRegisteringMaestro($maestro_name);
// $message = messageInfoBankAccountForRegisteringMaestro($maestro_name, $account_type);
// $header = "From:".$from.$new_line."BCC:".$bcc;
// mb_send_mail($mail_to, $subject, $message, $header);
mb_send_mail(
$mail_to,
subjectRegistered($maestro_name),
messageRegistered($maestro_name),
makeMailHeader($from, $bcc)
);
header("Content-Type: application/json");
}
function subjectRegistered($maestro_name) {
return "[초코마에] 마에스트로 계정 (".$maestro_name.") 등록 및 활성화 완료";
};
function messageRegistered($maestro_name) {
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
return "안녕하세요.".$new_line."[초코마에] 마에스트로 계정을 신청해 주셔서 감사합니다.".$new_line
.$new_line
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
."(이후에 [계정 유효기간 종료 예고], [계정 업그레이드] 등의 메일이 발송됩니다)".$new_line
.$new_line
.$new_line
."[".$maestro_name."] 마에스트로 계정이 활성화 되었습니다.".$new_line
.$new_line
."* 계정이 활성화되면 1년동안 사용하실 수 있습니다.".$new_line
."* 연장 결제를 해주시면, 남은 기간에 1년이 추가됩니다.".$new_line
."* 상위 요금제로 업그레이드 하셔도, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
.$new_line
.$new_line
."등록하신 마에스트로 계정 정보는 마에스트로 로그인 후, [계정 정보 수정] 화면에서 변경이 가능합니다.".$new_line
."(변경 가능 정보 : 마에스트로 아이디, 이메일, 암호)".$new_line
.$new_line
."감사합니다.".$new_line;
}
function makeMailHeader($from, $bcc) {
global $new_line;
return "From:".$from.$new_line."BCC:".$bcc;
}
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
header("Content-Type: application/json");
include "./../setup/connect_db.php";
include "./../lib/send_reply_json.php";
include "./../lib/maestro_account_info.php";
include "./../lib/db_maestro.php";
include "./mail_setting.php";
include "./send_mail.php";
$type = $_POST["type"];
$maestro_id = $_POST["maestro_id"];
$maestro_name = $_POST["maestro_name"];
$password = $_POST["password"];
$email = $_POST["email"];
$account_type = $_POST["account_type"];
$upgrade_account_type = $_POST["upgrade_account_type"];
if($type == "sendMailBankInfo") {
sendMailBankInfo($maestro_name, $email, $account_type);
} else if($type == "sendMailRegistered") {
sendMailRegistered($maestro_name, $email, $account_type);
/*
// maestro data
$maestro_data = get_maestro_data($maestro_id);
set_data("maestroData", $maestro_data);
// subject registered
$subject = subjectRegistered($maestro_data["name"]);
set_data("subject", $subject);
// messgae registered
$messgae = messageRegistered($maestro_data["name"]);
set_data("messgae", $messgae);
*/
} else if($type == "get_maestro_data") {
// maestro data
$maestro_data = get_maestro_data($maestro_id);
set_data("maestroData", $maestro_data);
// subject registered
$subject = subjectRegistered($maestro_data["name"]);
set_data("subject", $subject);
// messgae registered
$messgae = messageRegistered($maestro_data["name"]);
set_data("messgae", $messgae);
}
send_result_success();
exit;
?>
-87
View File
@@ -1,87 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
include "./../lib/maestro_account_info.php";
include "./mail_setting.php";
// $maestroID = $_POST["maestro_id"];
// $maestroName = $_POST["maestro_name"];
// $email = $_POST["email"];
// $accountType = $_POST["account_type"];
// $upgradeAccountType = $_POST["upgrade_account_type"];
$maestroID = 3;
$maestroName = "삼화초";
$email = "jisangs@daum.net";
$accountType = 1;
$upgradeAccountType = 2;
header("Content-Type: text/html; charset=UTF-8");
// from
$from = "support+chocomae@jinaju.com";
// to, bcc
$to = $email; // "jisangs@daum.net";
$bcc = "support+chocomae.automail@jinaju.com";
// subject
$subject = subjectInfoBankAccountForRegisteringMaestro($maestroName);
// $subject = "=?UTF-8?B?".base64_encode($subject)."?=";
// message
$message = messageInfoBankAccountForRegisteringMaestro($maestroName, $accountType);
// header
$header = "From:".$from.$newLine."BCC:".$bcc;
mb_send_mail($to, $subject, $message, $header);
header("Content-Type: application/json");
send_result_success();
exit;
// 마에스트로 계정 신청 - 입금 안내
function subjectInfoBankAccountForRegisteringMaestro($maestroName) {
return "[초코마에] 마에스트로 계정 (".$maestroName.") 등록을 위한 입금 안내";
};
function messageInfoBankAccountForRegisteringMaestro($maestroName, $accountType) {
global $newLine, $bankName, $bankAccountNo, $bankOwnerName;
return "안녕하세요.".$newLine."[초코마에] 마에스트로 계정을 신청해 주셔서 감사합니다.".$newLine
.$newLine
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$newLine
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$newLine
.$newLine
.$newLine
."[".$maestroName."] 마에스트로 계정을 활성화 하기 위한 은행 계좌 정보는 아래와 같습니다.".$newLine
."------------------------------------------------------------".$newLine
." * 은행 계좌 : ".$bankAccountNo." ( ".$bankName." )".$newLine
." * 예금주명 : ".$bankOwnerName.$newLine
." * 금액 : ".get_price($accountType)."".$newLine
.$newLine
." * 송금자명 : ".$maestroName." (신청하신 마에스트로 아이디)".$newLine
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$newLine
."------------------------------------------------------------".$newLine
.$newLine
."* 계정이 활성화되면 1년동안 사용하실 수 있습니다.".$newLine
."* 연장 결제를 해주시면, 남은 기간에 1년이 추가됩니다.".$newLine
."* 상위 요금제로 업그레이드 하셔도, 현재 계정의 남은 기간에 1년이 추가됩니다.".$newLine
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$newLine
.$newLine
.$newLine
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 활성화 해드리겠습니다.".$newLine
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$newLine
."마에스트로 계정이 활성화되는대로, 즉시 알림 메일을 드리겠습니다.".$newLine
.$newLine
."감사합니다.".$newLine;
}
?>