Add: PHPMailer to naver email
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
<?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_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 = 'chocomae@jinaju.com'; // 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();
|
||||||
|
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@daum.net";
|
||||||
|
$maestro_name = "박지상 마에스트로";
|
||||||
|
$subject = "Naver 메일 발신 테스트";
|
||||||
|
$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_naver_mail($maestro_email, $maestro_name, $subject, $body);
|
||||||
Reference in New Issue
Block a user