Add: test_gmail
This commit is contained in:
@@ -11,12 +11,18 @@ require './../PHPMailer/src/SMTP.php';
|
||||
// Load Composer's autoloader
|
||||
// require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
|
||||
|
||||
$sender_email = 'support@jinaju.com';
|
||||
$sender_name = '초코마에';
|
||||
function send_gmail($maestro_email, $maestro_name, $subject, $body) {
|
||||
global $new_line; // = "\r\n";
|
||||
global $html_br_tag; // = "<br/>";
|
||||
|
||||
function send_gmail($email, $name, $subject, $body) {
|
||||
global $sender_email;
|
||||
global $sender_name;
|
||||
// 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);
|
||||
|
||||
@@ -26,7 +32,7 @@ function send_gmail($email, $name, $subject, $body) {
|
||||
$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->Username = 'chocomae@jinaju.com'; // SMTP username
|
||||
$mail->Password = '52napark!'; // SMTP password
|
||||
$mail->CharSet = 'utf-8';
|
||||
$mail->Encoding = "base64";
|
||||
@@ -37,9 +43,9 @@ function send_gmail($email, $name, $subject, $body) {
|
||||
|
||||
//Recipients
|
||||
$mail->SetFrom($sender_email, $sender_name);
|
||||
$mail->addAddress($email, $name); // Add a recipient
|
||||
$mail->addReplyTo($sender_email, $sender_name);
|
||||
$mail->addCC($sender_email);
|
||||
$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
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?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
|
||||
@@ -193,7 +198,13 @@ function sendEmail($postParamData) {
|
||||
$timestamp = getTimeStamp();
|
||||
$signature = makeSignature($secret_key, $method, $request_url, $timestamp, $access_key);
|
||||
|
||||
cUrl($postParam, $timestamp, $signature);
|
||||
// cUrl($postParam, $timestamp, $signature);
|
||||
|
||||
$recipients = getPostParamData($postParamData, "recipients");
|
||||
$maestro_email = $recipients
|
||||
$subject = getPostParamData($postParamData, "title");
|
||||
$body = getPostParamData($postParamData, "body");
|
||||
send_mail($address, $subject, $body);
|
||||
}
|
||||
|
||||
|
||||
@@ -276,6 +287,7 @@ function makeSignature($secret_key, $method, $uri, $timestamp, $access_key) {
|
||||
return $signature;
|
||||
}
|
||||
|
||||
/*
|
||||
function cUrl($postParam, $timestamp, $signature) {
|
||||
global $host_name_url, $request_url, $access_key, $secret_key, $api_key, $method, $request_id;
|
||||
|
||||
@@ -323,7 +335,48 @@ function cUrl($postParam, $timestamp, $signature) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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);
|
||||
Reference in New Issue
Block a user