이메일 발송 SMTP 변경: naver -> gmail(jinaju.com)

* jinaju.com SPF 설정 작업이 선행됨
This commit is contained in:
2024-06-18 14:28:29 +09:00
parent ad16adeb21
commit 58392f82c9
15 changed files with 290 additions and 14 deletions
@@ -8,7 +8,7 @@ include __DIR__."/../../web/server/setup/connect_db.php";
include __DIR__."/../../web/php/mail/mail_setting.php";
include __DIR__."/../../web/server/mail/mail_contents.php";
include __DIR__."/../../web/server/lib/maestro_account_info.php";
include __DIR__."/../../web/server/mail/send_naver_mail.php";
include __DIR__."/../../web/server/mail/send_jinaju_mail.php";
$maestroList = null;
$maestroList = get_closed_beta_paid_maestro_list();
@@ -8,7 +8,7 @@ include __DIR__."/../../web/server/setup/connect_db.php";
include __DIR__."/../../web/php/mail/mail_setting.php";
include __DIR__."/../../web/server/mail/mail_contents.php";
include __DIR__."/../../web/server/lib/maestro_account_info.php";
include __DIR__."/../../web/server/mail/send_naver_mail.php";
include __DIR__."/../../web/server/mail/send_jinaju_mail.php";
add_1_month_closed_beta_paid_maestro();
@@ -8,7 +8,7 @@ include __DIR__."/../../web/server/setup/connect_db.php";
include __DIR__."/../../web/php/mail/mail_setting.php";
include __DIR__."/../../web/server/mail/mail_contents.php";
include __DIR__."/../../web/server/lib/maestro_account_info.php";
include __DIR__."/../../web/server/mail/send_naver_mail.php";
include __DIR__."/../../web/server/mail/send_jinaju_mail.php";
$maestroList = null;
$maestroList = get_overdated_maestro_list();
@@ -8,7 +8,7 @@ include __DIR__."/../../web/server/setup/connect_db.php";
include __DIR__."/../../web/php/mail/mail_setting.php";
include __DIR__."/../../web/server/mail/mail_contents.php";
include __DIR__."/../../web/server/lib/maestro_account_info.php";
include __DIR__."/../../web/server/mail/send_naver_mail.php";
include __DIR__."/../../web/server/mail/send_jinaju_mail.php";
$maestroList = null;
$maestroList = get_closed_beta_paid_maestro_list();
@@ -8,7 +8,7 @@ include __DIR__."/../../web/server/setup/connect_db.php";
include __DIR__."/../../web/php/mail/mail_setting.php";
include __DIR__."/../../web/server/mail/mail_contents.php";
include __DIR__."/../../web/server/lib/maestro_account_info.php";
include __DIR__."/../../web/server/mail/send_naver_mail.php";
include __DIR__."/../../web/server/mail/send_jinaju_mail.php";
//add_1_month_closed_beta_paid_maestro();
@@ -8,7 +8,7 @@ include __DIR__."/../../web/server/setup/connect_db.php";
include __DIR__."/../../web/php/mail/mail_setting.php";
include __DIR__."/../../web/server/mail/mail_contents.php";
include __DIR__."/../../web/server/lib/maestro_account_info.php";
include __DIR__."/../../web/server/mail/send_naver_mail.php";
include __DIR__."/../../web/server/mail/send_jinaju_mail.php";
$maestroList = null;
$maestroList = get_overdated_maestro_list();
+1 -1
View File
@@ -11,7 +11,7 @@ include "./../lib/maestro_log.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_naver_mail.php";
include "./../mail/send_jinaju_mail.php";
$maestro_extension_id = $_POST["maestro_extension_id"];
$maestro_id = $_POST["maestro_id"];
+1 -1
View File
@@ -12,7 +12,7 @@ include "./../lib/maestro_log.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_naver_mail.php";
include "./../mail/send_jinaju_mail.php";
$maestroID = $_POST["maestro_id"];
+1 -1
View File
@@ -10,7 +10,7 @@ include "./../mail/mail_setting.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_naver_mail.php";
include "./../mail/send_jinaju_mail.php";
$maestro_upgrade_id = $_POST["maestro_upgrade_id"];
$maestro_id = $_POST["maestro_id"];
+1 -1
View File
@@ -12,7 +12,7 @@ include "./../lib/maestro_log.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_naver_mail.php";
include "./../mail/send_jinaju_mail.php";
$maestro_name = $_POST["maestro_name"];
@@ -8,7 +8,7 @@ include "./../lib/db_maestro.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_naver_mail.php";
include "./../mail/send_jinaju_mail.php";
$maestro_id = $_POST["maestro_id"];
$available_date = $_POST["available_date"];
@@ -8,7 +8,7 @@ include "./../lib/db_maestro.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_naver_mail.php";
include "./../mail/send_jinaju_mail.php";
$maestro_id = $_POST["maestro_id"];
$registered_activate_status = $_POST["registered_activate_status"];
@@ -9,7 +9,7 @@ include "./../lib/maestro_log.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_naver_mail.php";
include "./../mail/send_jinaju_mail.php";
$maestroID = $_POST["maestro_id"];
$maestroName = $_POST["maestro_name"];
+276
View File
@@ -0,0 +1,276 @@
<?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 = "support+chocomae@jinaju.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.gmail.com'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = "support+chocomae@jinaju.com"; // SMTP username
$mail->Password = 'ixacckjjzvpugizl'; // 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 -1
View File
@@ -8,7 +8,7 @@ include "./../lib/db_maestro.php";
include './mail_setting.php';
include './mail_contents.php';
include './../lib/maestro_account_info.php';
include "./send_naver_mail.php";
include "./send_jinaju_mail.php";
$type = $_POST["type"];
$maestro_id = $_POST["maestro_id"];