사용하지 않는 메일 발송 시험·구형 파일 삭제
관리자 기능 삭제로 호출처가 사라졌거나 서비스 코드가 참조하지 않는 메일 파일을 제거한다. 가입/정보 수정/연장·업그레이드 안내 메일과 배치 메일은 send_jinaju_mail.php를 계속 사용한다. - send_mail_test.php, send_mail.php 삭제 - send_naver_mail.php, test_naver_mail.php 삭제 - send_gmail.php, test_gmail.php 삭제 - cloudOutboundMailerSample_20180928161712.php 삭제 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
50aee3bb4e
commit
ca078887a3
7 files changed
-1186
No files matched your search
@@ -1,97 +0,0 @@
|
||||
<?php
|
||||
|
||||
$hostNameUrl = "https://mail.apigw.ntruss.com"; // 호스트 URL
|
||||
$requestUrl= "/api/v1/mails"; // 요청 URI
|
||||
$accessKey = "YOUR_ACCESS_KEY"; // 네이버 클라우드 플랫폼 회원에게 발급되는 개인 인증키
|
||||
$secretKey = "YOUR_SECRET_KEY"; // 2차 인증을 위해 서비스마다 할당되는 service secret
|
||||
$apiKey = "YOU_API_KEY"; // API Gateway에서 발급받은 키 (primary key 또는 secondary key)
|
||||
$method = "POST"; // 요청 method mail 발송 : POST, 발송 확인 GET
|
||||
$requestId = ""; // 요청 ID
|
||||
|
||||
try {
|
||||
|
||||
|
||||
$timestamp = "";
|
||||
$microtime = "";
|
||||
list($microtime,$timestamp) = explode(' ',microtime());
|
||||
$timestamp = $timestamp.substr($microtime, 2, 3);
|
||||
|
||||
$is_post = false;
|
||||
if($method == "POST") {
|
||||
$postParam = array(
|
||||
"advertising" => false, // 광고메일여부 default: false
|
||||
"attachFileIds" => array_map(), // 첨부파일ID
|
||||
"body" => "", // Email 본문
|
||||
"individual" => true, // 개인발송여부 (개인발송 시 참조인, 숨은참조 무시됨) default: true
|
||||
"parameters" => array_map(), // 치환 파라미터 (전체 수신자에게 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
|
||||
"recipients" => array( // 수신자목록
|
||||
array(
|
||||
"address" => "", // 수신자 Email 주소
|
||||
"name" => "", // 수신자 명
|
||||
"type" => "", // 수신자 유형 (R: 수신자, C: 참조인, B: 숨은참조) default: R
|
||||
"parameters" => array_map(), // 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
|
||||
),
|
||||
),
|
||||
"referencesHeader" => "", // 특정 메일을 모아서 보기 위해 네이버 메일에서 지원하는 기능, 해당 필드에 동일한 값을 입력한 메일들을 모아서 볼 수 있다. (다음의 형태가 되어야 함 : <unique_id@domain.com> )
|
||||
"reservationUtc" => "", // 예약 발송 일시 ( 1970년 1월 1일 00:00:00 협정 세계시(UTC) 부터의 경과 시간을 1/1000초로 환산한 정수 ), reservationDateTime 값보다 이 값이 우선 적용된다.
|
||||
"reservationDateTime" => "", // 다음과 같은 형태의 예약 발송 일시 (‘yyyy-MM-dd HH:mm’ UTC+09:00), reservationUtc 값이 우선한다.
|
||||
"senderAddress" => "", // 발송자 Email 주소
|
||||
"senderName" => "", // 발송자 이름
|
||||
"tempRequestId" => "", // 첨부파일 등록 시 사용한 임시 요청 ID
|
||||
"templateSid" => "", // 템플릿 ID
|
||||
"title" => "", // Mail 제목
|
||||
);
|
||||
|
||||
$postParam = json_encode($postParam);
|
||||
|
||||
$is_post = true;
|
||||
|
||||
$success_code = 201;
|
||||
} else {
|
||||
$success_code = 200;
|
||||
$requestUrl = $requestUrl."/requests/".$requestId."/status";
|
||||
}
|
||||
|
||||
$signautue = makeSignature($secretKey, $method, $requestUrl, $timestamp, $accessKey);
|
||||
|
||||
$url = $hostNameUrl.$requestUrl;
|
||||
echo $url."\n";
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, $is_post);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
if($method == "POST") {
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postParam);
|
||||
}
|
||||
$headers = array();
|
||||
$headers[] = "X-NCP-APIGW-TIMESTAMP: " .$timestamp;
|
||||
$headers[] = "X-NCP-IAM-ACCESS-KEY: " .$accessKey;
|
||||
$headers[] = "X-NCP-APIGW-SIGNATURE-V2: " .$signautue;
|
||||
$headers[] = "content-type: application/json";
|
||||
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$response = curl_exec ($ch);
|
||||
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
echo "status_code:".$status_code."\n";
|
||||
curl_close ($ch);
|
||||
if($status_code == 200) {
|
||||
echo $response."\n";
|
||||
} else {
|
||||
echo "Error 내용:".$response."\n";
|
||||
}
|
||||
|
||||
} catch(Exception $E) {
|
||||
echo "Response: ". $E->lastResponse . "\n";
|
||||
}
|
||||
|
||||
function makeSignature($secretKey, $method, $uri, $timestamp, $accessKey) {
|
||||
$space = " ";
|
||||
$newLine = "\n";
|
||||
$hmac = $method.$space.$uri.$newLine.$timestamp.$newLine.$accessKey;
|
||||
$signautue = base64_encode(hash_hmac('sha256', $hmac, $secretKey,true));
|
||||
echo "this is signiture : ".$signautue."\n";
|
||||
return $signautue;
|
||||
}
|
||||
?>
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
require './../PHPMailer/src/Exception.php';
|
||||
require './../PHPMailer/src/PHPMailer.php';
|
||||
require './../PHPMailer/src/SMTP.php';
|
||||
|
||||
// Load Composer's autoloader
|
||||
// require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
|
||||
|
||||
function send_gmail($maestro_email, $maestro_name, $subject, $body) {
|
||||
global $new_line; // = "\r\n";
|
||||
global $html_br_tag; // = "<br/>";
|
||||
|
||||
// global $from; // = "support+chocomae@jinaju.com";
|
||||
// global $bcc; // = "support+chocomae.automail@jinaju.com";
|
||||
|
||||
// mail sender info
|
||||
global $sender_name; // = "초코마에";
|
||||
global $sender_email; // = $from;
|
||||
global $sender_address; // = $from;
|
||||
global $sender_bcc; // = $bcc;
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
//Server settings
|
||||
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
||||
$mail->isSMTP(); // Send using SMTP
|
||||
$mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'chocomae@jinaju.com'; // SMTP username
|
||||
$mail->Password = '52napark!'; // SMTP password
|
||||
$mail->CharSet = 'utf-8';
|
||||
$mail->Encoding = "base64";
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
|
||||
// $mail->SMTPSecure = 'ssl';
|
||||
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
|
||||
|
||||
|
||||
//Recipients
|
||||
$mail->SetFrom($sender_email, $sender_name);
|
||||
$mail->addAddress($maestro_email, $maestro_name); // Add a recipient
|
||||
$mail->addReplyTo($sender_address, $sender_name);
|
||||
$mail->addBCC($sender_bcc);
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body;
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,614 +0,0 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
require_once("./../PHPMailer/src/PHPMailer.php");
|
||||
require_once("./../PHPMailer/src/SMTP.php");
|
||||
require_once("./../PHPMailer/src/Exception.php");
|
||||
|
||||
|
||||
// variables for ncloud outbound mailer
|
||||
$host_name_url = "https://mail.apigw.ntruss.com"; // 호스트 URL
|
||||
$request_url= "/api/v1/mails"; // 요청 URI
|
||||
$access_key = "qNXWk443wdnDXrkPvoqr"; // 네이버 클라우드 플랫폼 회원에게 발급되는 개인 인증키
|
||||
$secret_key = "umWxQXulhNSya2CkMNqqVJnSRfwRaN8BjMUX0skV"; // 2차 인증을 위해 서비스마다 할당되는 service secret
|
||||
$api_key = "eWfapJfbR5W9NXPEsdXGzlJsShEV30DfxIV0d51J"; // API Gateway에서 발급받은 키 (primary key 또는 secondary key)
|
||||
$method = "POST"; // 요청 method mail 발송 : POST, 발송 확인 GET
|
||||
$request_id = ""; // 요청 ID
|
||||
|
||||
|
||||
////////////////////////
|
||||
// nCloud Outbound Mailer
|
||||
////////////////////////
|
||||
|
||||
function makeDefaultPostParamData($maestro_name, $maestro_email) {
|
||||
global $sender_email, $sender_name, $sender_bcc;
|
||||
|
||||
$postParamData["sender_address"] = $sender_email;
|
||||
$postParamData["sender_name"] = $sender_name;
|
||||
$postParamData["individual"] = false;
|
||||
$postParamData["title"] = null;
|
||||
$postParamData["body"] = null;
|
||||
$postParamData["recipients"] = array(
|
||||
array(
|
||||
"address" => $maestro_email, // 수신자 Email 주소
|
||||
"name" => "", // 수신자 명
|
||||
"type" => "R", // 수신자 유형 (R: 수신자, C: 참조인, B: 숨은참조) default: R
|
||||
// "parameters" => array_map(),
|
||||
// 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
|
||||
"parameters" => array(
|
||||
"maestro_name" => $maestro_name,
|
||||
), // 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
|
||||
),
|
||||
array(
|
||||
"address" => $sender_bcc, // 수신자 Email 주소
|
||||
"name" => "", // 수신자 명
|
||||
"type" => "B", // 수신자 유형 (R: 수신자, C: 참조인, B: 숨은참조) default: R
|
||||
"parameters" => array_map(),
|
||||
// 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
|
||||
),
|
||||
);
|
||||
|
||||
return $postParamData;
|
||||
}
|
||||
|
||||
function sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type) {
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "134";
|
||||
$postParamData["parameters"] = array(
|
||||
"account_type" => get_accout_type($account_type),
|
||||
"bank_account_no" => "3333-07-4977969",
|
||||
"bank_name" => "카카오뱅크",
|
||||
"bank_owner_name" => "박지상",
|
||||
"maestro_name" => $maestro_name,
|
||||
"price" => number_format(get_price($account_type))
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendMailRegisterDone($maestro_name, $maestro_email) {
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "138";
|
||||
$postParamData["parameters"] = array(
|
||||
"maestro_name" => $maestro_name,
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendMailUpgradeBankInfo($maestro_name, $maestro_email, $account_type, $upgrade_account_type) {
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "139";
|
||||
$postParamData["parameters"] = array(
|
||||
"account_type" => get_accout_type($account_type),
|
||||
"upgrade_account_type" => get_accout_type($upgrade_account_type),
|
||||
"bank_account_no" => "3333-07-4977969",
|
||||
"bank_name" => "카카오뱅크",
|
||||
"bank_owner_name" => "박지상",
|
||||
"maestro_name" => $maestro_name,
|
||||
"price" => number_format(get_price($upgrade_account_type) - get_price($account_type))
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendMailUpgradeDone($maestro_name, $maestro_email, $account_type, $upgrade_account_type) {
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "140";
|
||||
$postParamData["parameters"] = array(
|
||||
"account_type" => get_accout_type($account_type),
|
||||
"upgrade_account_type" => get_accout_type($upgrade_account_type),
|
||||
"maestro_name" => $maestro_name,
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email) {
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "161";
|
||||
$postParamData["parameters"] = array(
|
||||
"maestro_name_prev" => $maestro_name_prev,
|
||||
"maestro_name" => $maestro_name,
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev) {
|
||||
// send to new email
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "137";
|
||||
$postParamData["parameters"] = array(
|
||||
"maestro_email_prev" => $maestro_email_prev,
|
||||
"maestro_email" => $maestro_email,
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
|
||||
|
||||
// send to previous email
|
||||
$postParamDataPrev = makeDefaultPostParamData($maestro_name, $maestro_email_prev);
|
||||
|
||||
$postParamDataPrev["templateSid"] = "137";
|
||||
$postParamDataPrev["parameters"] = array(
|
||||
"maestro_email_prev" => $maestro_email_prev,
|
||||
"maestro_email" => $maestro_email,
|
||||
);
|
||||
|
||||
sendEmail($postParamDataPrev);
|
||||
}
|
||||
|
||||
|
||||
function sendMailExtensionBankInfo($maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type) {
|
||||
|
||||
// echo("$maestro_email : ".$maestro_email." / ");
|
||||
// echo("$available_date : ".$available_date);
|
||||
// return;
|
||||
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "335";
|
||||
$postParamData["parameters"] = array(
|
||||
"account_type" => get_accout_type($registered_account_type),
|
||||
"bank_account_no" => "3333-07-4977969",
|
||||
"bank_name" => "카카오뱅크",
|
||||
"bank_owner_name" => "박지상",
|
||||
"maestro_email" => $maestro_email,
|
||||
"maestro_name" => $maestro_name,
|
||||
"available_date" => $available_date,
|
||||
"new_available_date" => $new_available_date,
|
||||
"price" => number_format(get_price($registered_account_type))
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email) {
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "336";
|
||||
$postParamData["parameters"] = array(
|
||||
"maestro_name" => $maestro_name,
|
||||
"new_available_date" => $new_available_date
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendEmail($postParamData) {
|
||||
global $host_name_url, $request_url, $access_key, $secret_key, $api_key, $method, $request_id;
|
||||
global $sender_name, $sender_address;
|
||||
|
||||
$postParam = null;
|
||||
if($method == "POST") {
|
||||
$postParam = makePostParam($postParamData);
|
||||
// echo "\n\r".$postParam."\n\r";
|
||||
// set_data("postParam", $postParam);
|
||||
} else {
|
||||
$request_url = $request_url."/requests/".$request_id."/status";
|
||||
}
|
||||
|
||||
$timestamp = getTimeStamp();
|
||||
$signature = makeSignature($secret_key, $method, $request_url, $timestamp, $access_key);
|
||||
|
||||
// cUrl($postParam, $timestamp, $signature);
|
||||
|
||||
$recipients = getPostParamData($postParamData, "recipients");
|
||||
$maestro_email = $recipients;
|
||||
$subject = getPostParamData($postParamData, "title");
|
||||
$body = getPostParamData($postParamData, "body");
|
||||
send_mail($address, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
function makeRequestUrl() {
|
||||
global $method, $request_url, $request_id;
|
||||
|
||||
if($method == "POST")
|
||||
return $request_url;
|
||||
else
|
||||
return $request_url."/requests/".$request_id."/status";
|
||||
}
|
||||
|
||||
function getPostParamData($postParamData, $key) {
|
||||
if(array_key_exists($key, $postParamData))
|
||||
return $postParamData[$key];
|
||||
|
||||
switch($key) {
|
||||
case "body":
|
||||
case "sender_address":
|
||||
case "sender_name":
|
||||
case "templateSid":
|
||||
case "title":
|
||||
return "";
|
||||
break;
|
||||
|
||||
case "parameters":
|
||||
case "recipients":
|
||||
return array_map();
|
||||
break;
|
||||
|
||||
case "individual":
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function makePostParam($postParamData) {
|
||||
global $sender_name, $sender_address, $sender_bcc;
|
||||
|
||||
$postParam = array(
|
||||
"advertising" => false, // 광고메일여부 default: false
|
||||
"attachFileIds" => array_map(), // 첨부파일ID
|
||||
"body" => getPostParamData($postParamData, "body"), // Email 본문
|
||||
"individual" => getPostParamData($postParamData, "individual"),
|
||||
// 개인발송여부 (개인발송 시 참조인, 숨은참조 무시됨) default: true
|
||||
"parameters" => getPostParamData($postParamData, "parameters"),
|
||||
// 치환 파라미터 (전체 수신자에게 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
|
||||
"recipients" => getPostParamData($postParamData, "recipients"),
|
||||
"referencesHeader" => "",
|
||||
// 특정 메일을 모아서 보기 위해 네이버 메일에서 지원하는 기능, 해당 필드에 동일한 값을 입력한 메일들을 모아서 볼 수 있다. (다음의 형태가 되어야 함 : <unique_id@domain.com> )
|
||||
"reservationUtc" => "",
|
||||
// 예약 발송 일시 ( 1970년 1월 1일 00:00:00 협정 세계시(UTC) 부터의 경과 시간을 1/1000초로 환산한 정수 ), reservationDateTime 값보다 이 값이 우선 적용된다.
|
||||
"reservationDateTime" => "",
|
||||
// 다음과 같은 형태의 예약 발송 일시 (‘yyyy-MM-dd HH:mm’ UTC+09:00), reservationUtc 값이 우선한다.
|
||||
"sender_address" => getPostParamData($postParamData, "sender_address"), // 발송자 Email 주소
|
||||
"sender_name" => getPostParamData($postParamData, "sender_name"), // 발송자 이름
|
||||
"temprequest_id" => "", // 첨부파일 등록 시 사용한 임시 요청 ID
|
||||
"templateSid" => getPostParamData($postParamData, "templateSid"), // 템플릿 ID
|
||||
"title" => getPostParamData($postParamData, "title"), // Mail 제목
|
||||
);
|
||||
|
||||
return json_encode($postParam);
|
||||
}
|
||||
|
||||
function getTimeStamp() {
|
||||
$timestamp = "";
|
||||
$microtime = "";
|
||||
list($microtime,$timestamp) = explode(' ',microtime());
|
||||
$timestamp = $timestamp.substr($microtime, 2, 3);
|
||||
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
function makeSignature($secret_key, $method, $uri, $timestamp, $access_key) {
|
||||
$space = " ";
|
||||
$newLine = "\n";
|
||||
$hmac = $method.$space.$uri.$newLine.$timestamp.$newLine.$access_key;
|
||||
$signature = base64_encode(hash_hmac('sha256', $hmac, $secret_key,true));
|
||||
// set_data("signature", $signature);
|
||||
return $signature;
|
||||
}
|
||||
|
||||
/*
|
||||
function cUrl($postParam, $timestamp, $signature) {
|
||||
global $host_name_url, $request_url, $access_key, $secret_key, $api_key, $method, $request_id;
|
||||
|
||||
$is_post = false;
|
||||
if($method == "POST")
|
||||
$is_post = true;
|
||||
|
||||
try {
|
||||
$url = $host_name_url.$request_url;
|
||||
// echo $url."\n";
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, $is_post);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
if($method == "POST") {
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postParam);
|
||||
}
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "X-NCP-APIGW-TIMESTAMP: " .$timestamp;
|
||||
$headers[] = "X-NCP-IAM-ACCESS-KEY: " .$access_key;
|
||||
$headers[] = "X-NCP-APIGW-SIGNATURE-V2: " .$signature;
|
||||
$headers[] = "content-type: application/json";
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$response = curl_exec ($ch);
|
||||
|
||||
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
// echo "status_code:".$status_code."\n";
|
||||
curl_close ($ch);
|
||||
if($status_code == 200) {
|
||||
set_data("sendmail_respond", $response);
|
||||
set_data("sendmail_postParam", $postParam);
|
||||
} else if($status_code == 201) {
|
||||
set_data("sendmail_succeed", $response);
|
||||
set_data("sendmail_postParam", $postParam);
|
||||
} else {
|
||||
set_data("sendmail_error", $response);
|
||||
set_data("sendmail_error_postParam", $postParam);
|
||||
}
|
||||
|
||||
} catch(Exception $E) {
|
||||
set_data("sendmail_error", $E->lastResponse);
|
||||
set_data("sendmail_error_postParam", $postParam);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function send_mail($address, $subject, $body) {
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
//Server settings
|
||||
$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
||||
$mail->isSMTP(); // Send using SMTP
|
||||
$mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'support@jinaju.com'; // SMTP username
|
||||
$mail->Password = '52napark!'; // SMTP password
|
||||
$mail->CharSet = 'utf-8';
|
||||
$mail->Encoding = "base64";
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
|
||||
// $mail->SMTPSecure = 'ssl';
|
||||
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
|
||||
|
||||
|
||||
//Recipients
|
||||
$mail->SetFrom('support@jinaju.com', '초코마에');
|
||||
$mail->addAddress($address); // Add a recipient
|
||||
// foreach ($addresses as $address) {
|
||||
// $mail->addAddress($address);
|
||||
// }
|
||||
$mail->addReplyTo('support@jinaju.com', 'Information');
|
||||
$mail->addCC('support@jinaju.com');
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body;
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
//echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
////////////////////////
|
||||
// CentOS postfix e-mail sender (canceled)
|
||||
////////////////////////
|
||||
|
||||
|
||||
function makeMailHeader($from, $bcc) {
|
||||
global $new_line;
|
||||
|
||||
return "From:".$from.$new_line."BCC:".$bcc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
// 마에스트로 계정 신청 - 입금 안내
|
||||
function sendMailRegisterBankInfo($maestro_name, $mail_to, $account_type) {
|
||||
global $from, $bcc;
|
||||
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
mb_send_mail(
|
||||
$mail_to,
|
||||
subjectRegisterBankInfo($maestro_name),
|
||||
messageRegisterBankInfo($maestro_name, $account_type),
|
||||
makeMailHeader($from, $bcc)
|
||||
);
|
||||
|
||||
header("Content-Type: application/json");
|
||||
}
|
||||
|
||||
function subjectRegisterBankInfo($maestro_name) {
|
||||
return "[초코마에] ".$maestro_name." - 마에스트로 계정 등록을 위한 입금 안내";
|
||||
};
|
||||
|
||||
function messageRegisterBankInfo($maestro_name, $account_type) {
|
||||
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
|
||||
|
||||
$price = number_format(get_price($account_type));
|
||||
|
||||
return "안녕하세요.".$new_line.
|
||||
"[초코마에] 마에스트로 계정을 신청해 주셔서 감사합니다.".$new_line
|
||||
.$new_line
|
||||
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
|
||||
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
."신청하신 마에스트로 계정 내용은 아래와 같습니다.".$new_line
|
||||
."1) 아이디 : ".$maestro_name.$new_line
|
||||
."2) 요금제 : ".get_accout_type($account_type).$new_line
|
||||
.$new_line
|
||||
."계정 등록을 위한 은행 계좌 입금 정보는 아래와 같습니다.".$new_line
|
||||
."------------------------------------------------------------".$new_line
|
||||
." * 은행 계좌 : ".$bank_account_no." ( ".$bank_name.", 예금주 : ".$bank_owner_name." )".$new_line
|
||||
." * 금액 : ".$price." 원".$new_line
|
||||
." * 송금자명 : ".$maestro_name." (신청하신 마에스트로 아이디)".$new_line
|
||||
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$new_line
|
||||
."------------------------------------------------------------".$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 sendMailRegisterDone($maestro_name, $mail_to) {
|
||||
global $from, $bcc;
|
||||
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
mb_send_mail(
|
||||
$mail_to,
|
||||
subjectRegisterDone($maestro_name),
|
||||
messageRegisterDone($maestro_name),
|
||||
makeMailHeader($from, $bcc)
|
||||
);
|
||||
|
||||
header("Content-Type: application/json");
|
||||
}
|
||||
|
||||
function subjectRegisterDone($maestro_name) {
|
||||
return "[초코마에] ".$maestro_name." - 마에스트로 계정 등록 및 활성화 완료";
|
||||
};
|
||||
|
||||
function messageRegisterDone($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 sendMailUpgradeBankInfo($maestro_name, $mail_to, $account_type, $upgrade_account_type) {
|
||||
global $from, $bcc;
|
||||
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
mb_send_mail(
|
||||
$mail_to,
|
||||
subjectUpgradeBankInfo($maestro_name),
|
||||
messageUpgradeBankInfo($maestro_name, $account_type, $upgrade_account_type),
|
||||
makeMailHeader($from, $bcc)
|
||||
);
|
||||
|
||||
header("Content-Type: application/json");
|
||||
}
|
||||
|
||||
function subjectUpgradeBankInfo($maestro_name) {
|
||||
return "[초코마에] ".$maestro_name." - 마에스트로 계정 업그레이드를 위한 입금 안내";
|
||||
};
|
||||
|
||||
function messageUpgradeBankInfo($maestro_name, $account_type, $upgrade_account_type) {
|
||||
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
|
||||
|
||||
$price = number_format(get_price($upgrade_account_type) - get_price($account_type));
|
||||
|
||||
return "안녕하세요.".$new_line.
|
||||
"[초코마에] 마에스트로 계정 요금제 업그레이드를 신청해주셔서 감사합니다.".$new_line
|
||||
.$new_line
|
||||
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
|
||||
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
.$maestro_name." - 마에스트로 계정의 현재 요금제와 업그레이드 요금제는 아래와 같습니다.".$new_line
|
||||
."1) 현재 사용중인 요금제 : ".get_accout_type($account_type).$new_line
|
||||
."2) 신청하신 업그레이드 요금제 : ".get_accout_type($upgrade_account_type).$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
."계정 요금제 업그레이드를 위한 은행 계좌 입금 정보는 아래와 같습니다.".$new_line
|
||||
."------------------------------------------------------------".$new_line
|
||||
." * 은행 계좌 : ".$bank_account_no." ( ".$bank_name.", 예금주 : ".$bank_owner_name." )".$new_line
|
||||
." * 금액 : ".$price." 원".$new_line
|
||||
." * 송금자명 : ".$maestro_name." (신청하신 마에스트로 아이디)".$new_line
|
||||
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$new_line
|
||||
."------------------------------------------------------------".$new_line
|
||||
.$new_line
|
||||
."* 혹시 신청하신 아이디가 아니라 본인 이름등으로 송금되었다면, 송금자명을 본 메일로 답신 부탁드립니다.".$new_line
|
||||
.$new_line
|
||||
."* 상위 요금제로 업그레이드 하시면, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
|
||||
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 업그레이드 해드리겠습니다.".$new_line
|
||||
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$new_line
|
||||
."마에스트로 계정이 업그레이드 되는대로, 즉시 알림 메일을 드리겠습니다.".$new_line
|
||||
.$new_line
|
||||
."감사합니다.".$new_line;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
// 마에스트로 업그레이드 완료 안내
|
||||
function sendMailUpgradeDone($maestro_name, $mail_to, $account_type, $upgrade_account_type) {
|
||||
global $from, $bcc;
|
||||
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
mb_send_mail(
|
||||
$mail_to,
|
||||
subjectUpgradeDone($maestro_name),
|
||||
messageUpgradeDone($maestro_name, $account_type, $upgrade_account_type),
|
||||
makeMailHeader($from, $bcc)
|
||||
);
|
||||
|
||||
header("Content-Type: application/json");
|
||||
}
|
||||
|
||||
function subjectUpgradeDone($maestro_name) {
|
||||
return "[초코마에] ".$maestro_name." - 마에스트로 계정의 요금제 업그레이드 완료 알림";
|
||||
};
|
||||
|
||||
function messageUpgradeDone($maestro_name, $account_type, $upgrade_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." - 마에스트로 계정의 요금제가 [ ".get_accout_type($account_type)." ] 에서 [ ".get_accout_type($upgrade_account_type)." ] 로 업그레이드 되었습니다.".$new_line
|
||||
.$new_line
|
||||
."* 마에스트로 계정 유효기간이 업그레이드 되기 전 남은 기간 + 추가 1년으로 설정되었습니다.".$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
."등록하신 마에스트로 계정 정보는 마에스트로 로그인 후, [계정 정보 수정] 화면에서 변경이 가능합니다.".$new_line
|
||||
."(변경 가능 정보 : 마에스트로 아이디, 이메일, 암호)".$new_line
|
||||
.$new_line
|
||||
."감사합니다.".$new_line;
|
||||
}
|
||||
*/
|
||||
|
||||
?>
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
include "./../lib/db_maestro.php";
|
||||
|
||||
include './mail_setting.php';
|
||||
include './mail_contents.php';
|
||||
include './../lib/maestro_account_info.php';
|
||||
include "./send_jinaju_mail.php";
|
||||
|
||||
$type = $_POST["type"];
|
||||
$maestro_id = $_POST["maestro_id"];
|
||||
$maestro_name = $_POST["maestro_name"];
|
||||
$password = $_POST["password"];
|
||||
$available_date = $_POST["available_date"];
|
||||
$new_available_date = $_POST["new_available_date"];
|
||||
$maestro_email = $_POST["email"];
|
||||
$account_type = $_POST["account_type"];
|
||||
$upgrade_account_type = $_POST["upgrade_account_type"];
|
||||
$registered_account_type = $_POST["registered_account_type"];
|
||||
$maestro_name_prev = $_POST["maestro_name_prev"];
|
||||
$maestro_email_prev = $_POST["email_prev"];
|
||||
|
||||
if($type == "sendMailRegisterBankInfo") {
|
||||
$result = sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type);
|
||||
} else if($type == "sendMailRegistered") {
|
||||
$result = sendMailRegisterDone($maestro_name, $maestro_email);
|
||||
} else if($type == "sendMailUpgradeBankInfo") {
|
||||
$result = sendMailUpgradeBankInfo($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
|
||||
} else if($type == "sendMailUpgradeDone") {
|
||||
$result = sendMailUpgradeDone($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
|
||||
} else if($type == "sendMailUpdateMaestroName") {
|
||||
$result = sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email);
|
||||
} else if($type == "sendMailUpdateMaestroEmail") {
|
||||
$result = sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev);
|
||||
} else if($type == "sendMailExtensionBankInfo") {
|
||||
$result = sendMailExtensionBankInfo($maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type);
|
||||
} else if($type == "sendMailExtensionDone") {
|
||||
$result = sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email);
|
||||
} else if($type == "get_maestro_data") {
|
||||
// maestro data
|
||||
$maestro_data = get_maestro_data($maestro_id);
|
||||
set_data("maestroData", $maestro_data);
|
||||
}
|
||||
|
||||
set_data("sendMailResult", $result);
|
||||
send_result_success();
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -1,276 +0,0 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
error_reporting( E_ALL );
|
||||
ini_set( "display_errors", 1 );
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
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";
|
||||
|
||||
// Register
|
||||
function sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type) {
|
||||
global $subjectMap, $bodyMap, $bank_account_no;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['registrationBankInfo']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['registrationBankInfo']);
|
||||
$body = str_replace("{{student_count}}", get_max_player_count($account_type), $body);
|
||||
$price = number_format(get_price($account_type));
|
||||
$body = str_replace("{{price}}", $price, $body);
|
||||
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
function sendMailRegisterDone($maestro_name, $maestro_email) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['registrationDone']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['registrationDone']);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
// Register - closed beta, trial maestro
|
||||
function sendMailTrialRegisterDone($maestro_name, $maestro_email, $account_type) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['trialMaestroRegistrationDone']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['trialMaestroRegistrationDone']);
|
||||
$body = str_replace("{{student_count}}", get_max_player_count($account_type), $body);
|
||||
$price = number_format(get_price($account_type));
|
||||
$body = str_replace("{{price}}", $price, $body);
|
||||
$today = date("Y-m-d"); //현재 날짜
|
||||
$two_weeks_later = date("Y-m-d", strtotime($today."+2 weeks"));
|
||||
$body = str_replace("{{two_weeks_later}}", $two_weeks_later, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
// Extend
|
||||
function sendMailExtensionBankInfo($maestro_name, $prev_date, $new_available_date, $maestro_email, $account_type) {
|
||||
global $subjectMap, $bodyMap, $bank_account_no;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['extensionBankInfo']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['extensionBankInfo']);
|
||||
$body = str_replace("{{student_count}}", get_max_player_count($account_type), $body);
|
||||
$price = number_format(get_price($account_type));
|
||||
$body = str_replace("{{price}}", $price, $body);
|
||||
$body = str_replace("{{prev_date}}", $prev_date, $body);
|
||||
$body = str_replace("{{new_available_date}}", $new_available_date, $body);
|
||||
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
function sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['extensionDone']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['extensionDone']);
|
||||
$body = str_replace("{{new_available_date}}", $new_available_date, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
// Upgrade - trial maestro
|
||||
function sendMailTrialMaestroUpgradeBankInfo($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
|
||||
global $subjectMap, $bodyMap, $bank_account_no;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['trialMaestroUpgradeBankInfo']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['trialMaestroUpgradeBankInfo']);
|
||||
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
|
||||
$prev_price = number_format(get_price($prev_account_type));
|
||||
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
|
||||
$upgrade_price = number_format(get_price($upgrade_account_type));
|
||||
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
|
||||
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
|
||||
$body = str_replace("{{price}}", $upgrade_price, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
function sendMailTrialMaestroUpgradeDone($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['trialMaestroUpgradeDone']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['trialMaestroUpgradeDone']);
|
||||
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
|
||||
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
|
||||
$upgrade_price = number_format(get_price($upgrade_account_type));
|
||||
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
// Upgrade
|
||||
function sendMailUpgradeBankInfo($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
|
||||
global $subjectMap, $bodyMap, $bank_account_no;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['upgradeBankInfo']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['upgradeBankInfo']);
|
||||
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
|
||||
$prev_price = number_format(get_price($prev_account_type));
|
||||
$body = str_replace("{{prev_price}}", $prev_price, $body);
|
||||
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
|
||||
$upgrade_price = number_format(get_price($upgrade_account_type));
|
||||
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
|
||||
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
|
||||
$charge_price = get_price($upgrade_account_type) - get_price($prev_account_type);
|
||||
// $charge_price = (int)$upgrade_price - (int)$prev_price;
|
||||
$body = str_replace("{{price}}", number_format($charge_price), $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
function sendMailUpgradeDone($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['upgradeDone']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['upgradeDone']);
|
||||
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
|
||||
$prev_price = number_format(get_price($prev_account_type));
|
||||
$body = str_replace("{{prev_price}}", $prev_price, $body);
|
||||
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
|
||||
$upgrade_price = number_format(get_price($upgrade_account_type));
|
||||
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
// Update
|
||||
function sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{update_maestro_name}}", $maestro_name, $subjectMap['updateMaestroName']);
|
||||
|
||||
$body = str_replace("{{prev_maestro_name}}", $maestro_name_prev, $bodyMap['updateMaestroName']);
|
||||
$body = str_replace("{{update_maestro_name}}", $maestro_name, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
function sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = $subjectMap['updateMaestroEmail'];
|
||||
|
||||
$body = str_replace("{{prev_email}}", $maestro_email_prev, $bodyMap['updateMaestroEmail']);
|
||||
$body = str_replace("{{update_email}}", $maestro_email, $body);
|
||||
|
||||
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
}
|
||||
|
||||
// experation
|
||||
function sendMailTo7DaysLeftMestroEmail($maestro_name, $maestro_email, $available_date) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['7daysLeft']);
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
function sendMailToClosedBetaPaidMestroEmail($maestro_name, $maestro_email, $available_date) {
|
||||
global $subjectMap, $bodyMap;
|
||||
|
||||
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['closedBetaPaid']);
|
||||
|
||||
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['closedBetaPaid']);
|
||||
$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';
|
||||
|
||||
function send_naver_mail($maestro_email, $maestro_name, $subject, $body) {
|
||||
global $new_line; // = "\r\n";
|
||||
global $html_br_tag; // = "<br/>";
|
||||
|
||||
// global $from; // = "support+chocomae@jinaju.com";
|
||||
// global $bcc; // = "support+chocomae.automail@jinaju.com";
|
||||
|
||||
// mail sender info
|
||||
global $sender_name; // = "초코마에";
|
||||
$sender_email = "jisangs@naver.com"; // = $from;
|
||||
global $sender_address; // = $from;
|
||||
global $sender_bcc; // = $bcc;
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
//Server settings
|
||||
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Send using SMTP
|
||||
$mail->Host = 'smtp.naver.com'; // Set the SMTP server to send through
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = $sender_email; // SMTP username
|
||||
$mail->Password = 'n52napark!'; // SMTP password
|
||||
$mail->CharSet = 'utf-8';
|
||||
$mail->Encoding = "base64";
|
||||
// $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
|
||||
$mail->SMTPSecure = 'ssl';
|
||||
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
|
||||
|
||||
|
||||
//Recipients
|
||||
$mail->SetFrom($sender_email, $sender_name);
|
||||
$mail->addAddress($maestro_email, $maestro_name); // Add a recipient
|
||||
$mail->addReplyTo($sender_address, $sender_name);
|
||||
$mail->addBCC($sender_bcc);
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body;
|
||||
|
||||
$mail->send();
|
||||
|
||||
// set_data("message", "Message has been sent");
|
||||
// send_result_success();
|
||||
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
// set_error_code("Message could not be sent. Mailer Error: {".$mail->ErrorInfo."}");
|
||||
// send_result_success();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include_once "./mail_setting.php";
|
||||
include_once "./send_gmail.php";
|
||||
|
||||
$maestro_email = "jisangs@naver.com";
|
||||
$maestro_name = "박지상 마에스트로";
|
||||
$subject = "Gmail 발신 테스트";
|
||||
$body = "안녕하세요.".$new_line.
|
||||
"[초코마에] 마에스트로 계정 요금제 업그레이드를 신청해주셔서 감사합니다.".$new_line
|
||||
.$new_line
|
||||
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
|
||||
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
.$maestro_name." - 마에스트로 계정의 현재 요금제와 업그레이드 요금제는 아래와 같습니다.".$new_line
|
||||
."1) 현재 사용중인 요금제 : ////".$new_line
|
||||
."2) 신청하신 업그레이드 요금제 : ////".$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
."계정 요금제 업그레이드를 위한 은행 계좌 입금 정보는 아래와 같습니다.".$new_line
|
||||
."------------------------------------------------------------".$new_line
|
||||
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$new_line
|
||||
."------------------------------------------------------------".$new_line
|
||||
.$new_line
|
||||
."* 혹시 신청하신 아이디가 아니라 본인 이름등으로 송금되었다면, 송금자명을 본 메일로 답신 부탁드립니다.".$new_line
|
||||
.$new_line
|
||||
."* 상위 요금제로 업그레이드 하시면, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
|
||||
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
|
||||
.$new_line
|
||||
.$new_line
|
||||
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 업그레이드 해드리겠습니다.".$new_line
|
||||
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$new_line
|
||||
."마에스트로 계정이 업그레이드 되는대로, 즉시 알림 메일을 드리겠습니다.".$new_line
|
||||
.$new_line
|
||||
."감사합니다.".$new_line;
|
||||
|
||||
|
||||
send_gmail($maestro_email, $maestro_name, $subject, $body);
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include './mail_setting.php';
|
||||
include './mail_contents.php';
|
||||
include './../lib/maestro_account_info.php';
|
||||
include "./send_naver_mail.php";
|
||||
|
||||
$br = "<br>";
|
||||
|
||||
$maestro_email = "jisangs@daum.net";
|
||||
$maestro_name = "박지상 마에스트로";
|
||||
$subject = "Naver 메일 발신 테스트";
|
||||
$body = "안녕하세요.".$br.
|
||||
"[초코마에] 마에스트로 계정 요금제 업그레이드를 신청해주셔서 감사합니다.".$br
|
||||
.$br
|
||||
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$br
|
||||
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$br
|
||||
.$br
|
||||
.$br
|
||||
.$maestro_name." - 마에스트로 계정의 현재 요금제와 업그레이드 요금제는 아래와 같습니다.".$br
|
||||
."1) 현재 사용중인 요금제 : ////".$br
|
||||
."2) 신청하신 업그레이드 요금제 : ////".$br
|
||||
.$br
|
||||
.$br
|
||||
."계정 요금제 업그레이드를 위한 은행 계좌 입금 정보는 아래와 같습니다.".$br
|
||||
."------------------------------------------------------------".$br
|
||||
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$br
|
||||
."------------------------------------------------------------".$br
|
||||
.$br
|
||||
."* 혹시 신청하신 아이디가 아니라 본인 이름등으로 송금되었다면, 송금자명을 본 메일로 답신 부탁드립니다.".$br
|
||||
.$br
|
||||
."* 상위 요금제로 업그레이드 하시면, 현재 계정의 남은 기간에 1년이 추가됩니다.".$br
|
||||
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$br
|
||||
.$br
|
||||
.$br
|
||||
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 업그레이드 해드리겠습니다.".$br
|
||||
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$br
|
||||
."마에스트로 계정이 업그레이드 되는대로, 즉시 알림 메일을 드리겠습니다.".$br
|
||||
.$br
|
||||
."감사합니다.".$br;
|
||||
|
||||
|
||||
send_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||
Reference in new issue
Block a user