diff --git a/src/php-cli/batch/send_mail_to_7days_left_maestro.php b/src/php-cli/batch/send_mail_to_7days_left_maestro.php
index 836bcdc..119f96d 100644
--- a/src/php-cli/batch/send_mail_to_7days_left_maestro.php
+++ b/src/php-cli/batch/send_mail_to_7days_left_maestro.php
@@ -4,40 +4,42 @@
include "./../../web/server/setup/connect_db.php";
-include "./../../web/php/mail/mail_sender.php";
+//include "./../../web/php/mail/chocomae_info.php";
include "./../../web/php/mail/mail_setting.php";
-include "./../../web/php/mail/chocomae_info.php";
+include './../../web/server/mail/mail_contents.php';
+include './../../web/server/lib/maestro_account_info.php';
+include "./../../web/server/mail/send_naver_mail.php";
$maestroList = null;
-$maestroList = get_maestro_list();
-print_r($maestroList);
+$maestroList = get_7days_left_maestro_list();
+//print_r($maestroList);
+
+foreach ($maestroList as $maestro) {
+ $result = sendMailTo7DaysLeftMestroEmail($maestro["maestroName"], $maestro["email"], $maestro["availableActivateDateTime"]);
+// printf("result : %s\n", $result);
+}
+
exit;
-function get_maestro_list(): array
+function get_7days_left_maestro_list(): array
{
global $db_conn;
- /*
$query = "
-select MaestroID, Name, AccountType, ActivateStatus, AvailableActivateDateTime, AcceptClausesDateTime, PlayerCount
+select MaestroID, Name, Email, AccountType, ActivateStatus, AvailableActivateDateTime, AcceptClausesDateTime, PlayerCount
from maestro
where DATE(AvailableActivateDateTime) - INTERVAL 7 DAY = DATE(NOW()) AND ActivateStatus = 1
";
- */
- $query = "
-select MaestroID, Name, AccountType, ActivateStatus, AvailableActivateDateTime, AcceptClausesDateTime, PlayerCount
-from maestro
-where DATE(AvailableActivateDateTime) - INTERVAL 70 DAY < DATE(NOW()) AND ActivateStatus = 1
- ";
$stmt = $db_conn->prepare($query);
$stmt->execute();
- $stmt->bind_result($maestroID, $name, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
+ $stmt->bind_result($maestroID, $name, $email, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
$maestroList = array();
while($stmt->fetch()) {
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $name;
+ $maestro["email"] = $email;
$maestro["accountType"] = $accountType;
$maestro["activateStatus"] = $activateStatus;
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
diff --git a/src/php-cli/batch/send_mail_to_overdated_maestro.php b/src/php-cli/batch/send_mail_to_overdated_maestro.php
new file mode 100644
index 0000000..a86d6d2
--- /dev/null
+++ b/src/php-cli/batch/send_mail_to_overdated_maestro.php
@@ -0,0 +1,54 @@
+prepare($query);
+ $stmt->execute();
+ $stmt->bind_result($maestroID, $name, $email, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
+
+ $maestroList = array();
+ while($stmt->fetch()) {
+ $maestro["maestroID"] = $maestroID;
+ $maestro["maestroName"] = $name;
+ $maestro["email"] = $email;
+ $maestro["accountType"] = $accountType;
+ $maestro["activateStatus"] = $activateStatus;
+ $maestro["availableActivateDateTime"] = $availableActivateDateTime;
+ $maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
+ $maestro["playerCount"] = $playerCount;
+ array_push($maestroList, $maestro);
+ }
+
+ return $maestroList;
+}
+
+?>
\ No newline at end of file
diff --git a/src/php-cli/batch/test_send_mail_to_7days_left_maestro.php b/src/php-cli/batch/test_send_mail_to_7days_left_maestro.php
new file mode 100644
index 0000000..06bfea0
--- /dev/null
+++ b/src/php-cli/batch/test_send_mail_to_7days_left_maestro.php
@@ -0,0 +1,54 @@
+prepare($query);
+ $stmt->execute();
+ $stmt->bind_result($maestroID, $name, $email, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
+
+ $maestroList = array();
+ while($stmt->fetch()) {
+ $maestro["maestroID"] = $maestroID;
+ $maestro["maestroName"] = $name;
+ $maestro["email"] = $email;
+ $maestro["accountType"] = $accountType;
+ $maestro["activateStatus"] = $activateStatus;
+ $maestro["availableActivateDateTime"] = $availableActivateDateTime;
+ $maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
+ $maestro["playerCount"] = $playerCount;
+ array_push($maestroList, $maestro);
+ }
+
+ return $maestroList;
+}
+
+?>
\ No newline at end of file
diff --git a/src/php-cli/batch/test_send_mail_to_overdated_maestro.php b/src/php-cli/batch/test_send_mail_to_overdated_maestro.php
new file mode 100644
index 0000000..3a7fc3e
--- /dev/null
+++ b/src/php-cli/batch/test_send_mail_to_overdated_maestro.php
@@ -0,0 +1,54 @@
+prepare($query);
+ $stmt->execute();
+ $stmt->bind_result($maestroID, $name, $email, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
+
+ $maestroList = array();
+ while($stmt->fetch()) {
+ $maestro["maestroID"] = $maestroID;
+ $maestro["maestroName"] = $name;
+ $maestro["email"] = $email;
+ $maestro["accountType"] = $accountType;
+ $maestro["activateStatus"] = $activateStatus;
+ $maestro["availableActivateDateTime"] = $availableActivateDateTime;
+ $maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
+ $maestro["playerCount"] = $playerCount;
+ array_push($maestroList, $maestro);
+ }
+
+ return $maestroList;
+}
+
+?>
\ No newline at end of file
diff --git a/src/web/server/mail/mail_contents.php b/src/web/server/mail/mail_contents.php
index fa05140..ec2656a 100644
--- a/src/web/server/mail/mail_contents.php
+++ b/src/web/server/mail/mail_contents.php
@@ -298,12 +298,12 @@ $bodyMap['updateMaestroEmail'] = "안녕하세요.
".
// expiration
-$subjectMap['expiration7days'] = "[초코마에] 타자나라 마에스트로 계정 유효기간 - 7일 후 만료 안내";
-$bodyMap['expiration7days'] = "안녕하세요.
".
-"[초코마에] 마에스트로 계정을 이용해 주셔서 감사합니다.
".
+$subjectMap['7daysLeft'] = "[초코마에] {{maestro_name}} 마에스트로 계정 유효기간 - 7일 후 만료 안내";
+$bodyMap['7daysLeft'] = "안녕하세요.
".
+"[초코마에] {{maestro_name}} 마에스트로 계정을 이용해 주셔서 감사합니다.
".
"
".
-"현재 이용중이신 마에스트로 계정의 유효기간이 7일밖에 남지 않았습니다.
".
-"* 유효기간 : ~ {{date}}
".
+"현재 이용중이신 {{maestro_name}} 마에스트로 계정의 유효기간이 7일밖에 남지 않았습니다.
".
+"* 유효기간 : ~ {{available_date}}
".
"
".
"7일 후에는 휴면 계정으로 전환되고, 학생들이 초코마에 서비스에 로그인하지 못하게 됩니다.
".
"초코마에 서비스를 계속 사용하기를 희망하신다면 잊지 말고 서비스 연장을 신청해 주세요.
".
@@ -318,30 +318,30 @@ $bodyMap['expiration7days'] = "안녕하세요.
".
"
".
"감사합니다.";
-$subjectMap['expiration30days'] = "[초코마에] 컴퓨터교실 마에스트로 계정 유효기간 - 30일 후 만료 예고 및 연장 안내";
-$bodyMap['expiration30days'] = "안녕하세요.
".
+$subjectMap['overdated'] = "[초코마에] {{maestro_name}} 마에스트로 계정 유효기간 종료 안내";
+$bodyMap['overdated'] = "안녕하세요.
".
"
".
-"[초코마에] 마에스트로 계정을 이용해 주셔서 감사합니다.
".
+"[초코마에] {{maestro_name}} 마에스트로 계정을 이용해 주셔서 감사합니다.
".
"
".
"
".
-"현재 이용중이신 마에스트로 계정의 유효기간이 30일밖에 남지 않았습니다.
".
-"* 유효 기간 : ~ {{date}}
".
+"현재 이용중이신 마에스트로 계정의 유효기간이 종료되었습니다.
".
+"* 유효 기간 : ~ {{available_date}}
".
"
".
-"아래에 준비된 여러가지 방법 중 하나를 골라, 유효기간을 연장하실 수 있습니다.
".
+"마에스트로 계정이 휴면 상태로 전환되었습니다.
".
+"* 학생 계정이 로그인할 수 없는 상태로 변경되었습니다.
".
+"* 마에스트로 계정 정보와 학생 정보는 6개월가량 유지됩니다.
".
+"* 이후 서버 부담을 줄이기 위해 해당 정보들이 삭제됩니다.
".
+"
".
+"
".
+"아래에 방법중 하나를 골라 유료 결제하여 마에스트로 계정을 다시 활성화시킬 수 있습니다.
".
"
".
"1) 마에스트로 관리 화면에서 [유효기간 연장] 버튼을 클릭
".
-": 현재 사용중이신 요금제를 유지하며, 남은 기간에 +1년을 추가로 사용하실 수 있습니다.
".
+": 현재 사용중이신 요금제를 유지하며, 남은 기간에 +1년을 추가로 사용하실 수 있습니다.
".
"
".
"2) 마에스트로 관리 화면에서 [업그레이드] 버튼을 클릭
".
": 좀 더 많은 학생수로 업그레이드하고, 업그레이드한 날짜로부터 +1년을 추가로 사용하실 수 있습니다.
".
"
".
"
".
-"만약 연장, 업데이트하지 않고 유효기간이 만료되면 휴면 계정으로 전환됩니다.
".
-"학생 계정의 로그인이 안되고 서비스를 사용하실 수 없게 되는데요. 계정 정보 및 학생 정보는 6개월가량 유지됩니다.
".
-"
".
-"남은 기간동안 연장 신청 여부를 생각해봐주세요.
".
-"그리고 연장 신청을 원하신다면 기한 안에 꼭 신청 부탁드릴게요.
".
-"
".
"감사합니다.";
diff --git a/src/web/server/mail/send_naver_mail.php b/src/web/server/mail/send_naver_mail.php
index d9c524b..5db35de 100644
--- a/src/web/server/mail/send_naver_mail.php
+++ b/src/web/server/mail/send_naver_mail.php
@@ -7,9 +7,9 @@ ini_set( "display_errors", 1 );
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
-require './../PHPMailer/src/Exception.php';
-require './../PHPMailer/src/PHPMailer.php';
-require './../PHPMailer/src/SMTP.php';
+require_once __DIR__.'/../PHPMailer/src/Exception.php';
+require_once __DIR__.'/../PHPMailer/src/PHPMailer.php';
+require_once __DIR__.'/../PHPMailer/src/SMTP.php';
include_once "mail_setting.php";
@@ -182,17 +182,30 @@ function sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_emai
}
// experation
-function sendMailExperation30days($maestro_name, $maestro_email, $maestro_email_prev) {
+function sendMailTo7DaysLeftMestroEmail($maestro_name, $maestro_email, $available_date) {
global $subjectMap, $bodyMap;
- $subject = $subjectMap['experation30days'];
+ $subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['7daysLeft']);
- $body = str_replace("{{prev_email}}", $maestro_email_prev, $bodyMap['experation30days']);
- $body = str_replace("{{update_email}}", $maestro_email, $body);
+ $body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['7daysLeft']);
+ $body = str_replace("{{available_date}}", $available_date, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
+function sendMailToOverDatedMestroEmail($maestro_name, $maestro_email, $available_date) {
+ global $subjectMap, $bodyMap;
+
+ $subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['overdated']);
+
+ $body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['overdated']);
+ $body = str_replace("{{available_date}}", $available_date, $body);
+
+ return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
+}
+
+
+
// Load Composer's autoloader
// require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';