[25.11.30버전] 구글 이메질 전송 앱비밀번호 설정 정보
[25.11.30버전] 구글 이메질 전송 앱비밀번호 설정
첨부파일
테스트한 버전5.4
호환 가능 버전5.3 이상
본문
[최신버전] 구글 SMTP 설정을 통한 이메일 보내기] 업데이트 버전입니다.!-->
/lib 폴더 밑으로 phpmailer 폴더를 넣으세요
https://sir.kr/g5_plugin/11719?sfl=wr_subject&stx=%EA%B5%AC%EA%B8%80
구글앱비밀번호 추출하는 플로우가 바뀌어서 첨부하여드립니다.
- 구글이메일 전송시 속도는 느린것 같습니다.
구글앱비밀번호 생성하는곳을 모르겠다고 하시는 분들이 많아서 안내하여 드립니다.
구글로그인이후 오른쪽에 계정관리 클릭하시면 계정설정화면으로 들어가는데
앱 비밀번호라고 검색하시면 검색하면이 이렇게 뜨실겁니다 여기에서 선택하시면 됩니다.
이렇게 만든 비밀번호를 입력한다
/lib 폴더 밑으로 phpmailer 폴더를 넣으세요
<?php
//include_once "../_inc/_config.php";
include_once "./lib/PHPMailer/PHPMailerAutoload.php";
// 설정 변수
$digit = random_int(100000, 999999);
$fmail = "보내는메일";
// $fmail = "*** 개인정보보호를 위한 이메일주소 노출방지 ***";
$fname = "[OOO 고객센터]";
$mail_subject = "[OOO] 회원인증메일";
$mail_content.=' <div id="mailform" style="padding: 30px 5%;">';
$mail_content.=' <div class="title" style="margin: 0 0 24px 0;"><span style=" display: inline-flex;
padding: 0 0 20px 0;
font-size: 20px;
line-height: 1;
color: #00b2a9;
border-bottom: 2px solid #00b2a9;">New Account Registration Code</span></div>';
$mail_content.=' <div class="cont">';
$mail_content.=' <div class="tit" style="margin: 0 0 24px 0;
font-size: 20px;
font-weight: 600;
color: #1c1c1c;">Welcome to OOOO!</div>';
$mail_content.=' <div class="txt" style=" font-size: 12px;
margin: 0 0 32px 0;
color: #1C1C1C;">Here’s your authentication code to create your OOOO account.<br>Please enter the code below now to verify this email address.</div>';
$mail_content.=' <div class="code" style=" display: block;
flex-direction: column;
margin: 0 0 40px 0;">';
$mail_content.=' <span style=" margin: 0 0 10px 0;
font-size: 12px;
color: #000;">Code :</span>';
$mail_content.=' <strong style=" display: block;
height: 60px;
font-size: 14px;
color: #00b2a9;
align-items: center;
justify-content: center;
background: #F6F6F6;
line-height: 60px;
text-align: center;">'.$digit.'</a>
<div class="tit" style="margin: 0 0 24px 0;
font-size: 14px;
font-weight: 600;
color: #1c1c1c;">위의 코드를 클릭하시면 인증이 완료됩니다.</div></strong>';
$mail_content.=' </div>';
$mail_content.=' </div>';
$mail_content.=' </div>';
$to = "받는사람 이메일";
if($to) {
try {
$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPDebug = 2;
$mail->SMTPDebug = SMTP::DEBUG_OFF;
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->SMTPKeepAlive = true;
$mail->Host = 'smtp.gmail.com';
$mail->Username = '구글계정';//
$mail->Password = '구글2단계 인증 앱비밀번호 입력란';
// $mail->Port = '587'; // SMTP server
$mail->Port = '465'; // SMTP server
// $mail->SMTPSecure = 'tls';
$mail->SMTPSecure = 'ssl';
// $mail->Mailer = "smtp";
$mail->CharSet = 'UTF-8';
$mail->Encoding = 'base64';
//$mail->AddEmbeddedImage('../logo.png', 'logo_2u');
$mail->setFrom($fmail, $fname);
$mail->addAddress($to);
$mail->isHTML(true);
$mail->Subject = $mail_subject;
$mail->Body = $mail_content;
$result = $mail->send();
} catch (Exception $e) {
}
}else{
}
?>
이하 기존파일과 동일합니다.
문의는 카톡으로 남겨주세요
그누보드/영카트 제작문의
카톡 : dev.megahit
!-->!-->
추천
1
1
댓글 전체

감사합니다 ^^

감사합니다
