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
@@ -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;
}
?>