sendmail 허용 안하는 웹호스팅에서 SMTP 사용하는 법 채택완료

send_mail을 허용 안하는 웹호스팅에서 SMTP 사용하는 법을 알려 주세요.

 

config.php 파일에서 네이버 SMTP를 사용하기 위해서,

 

define('G5_SMTP', 'smtp.naver.com');
define('G5_SMTP_PORT', 465);
define('G5_SMTP_SECURE', 'ssl');
define('G5_SMTP_USER', 'xxx@naver.com');
define('G5_SMTP_PASS', '앱비밀번호'); //네이버 앱비밀번호 입력
define('G5_SMTP_TIMEOUT', 10);   //무한루프 방지

 

이렇게 설정해 봤는데도 메일이 전혀 들어오지 않네요.

 

사이트 무한루프 현상은 

define('G5_SMTP_TIMEOUT', 10);   //무한루프 방지 

이부분 시간만큼만 지체한 후 넘어갑니다.

 

config.php 파일에 위 내용 추가한것 말고는 mailer.lib.php 를 포함해서,

메일관련한 다른 파일들은 그누보드 원본파일 그대로 입니다.

mail() 함수나 sendmail 을 지원하지 않는 서버에서

그누보드 메일발송 기능을 사용하는 방법을 알고 싶습니다.

답변 5개

채택된 답변
+20 포인트

/lib/mailer.lib.php 에서 아래 내용으로 수정만하면 다른곳은 원본그대로 사용.

Copy
if (defined('G5_SMTP') && G5_SMTP) {
            $mail->IsSMTP(); // telling the class to use SMTP
            $mail->Host = G5_SMTP; // SMTP server
            if(defined('G5_SMTP_PORT') && G5_SMTP_PORT)
                $mail->Port = G5_SMTP_PORT;
        }
=>
        if (defined('G5_SMTP') && G5_SMTP) {
            $mail->isSMTP();
            $mail->Host = 'smtp.naver.com';
            $mail->SMTPAuth = true;
            $mail->Username = '*** 개인정보보호를 위한 이메일주소 노출방지 ***'; // 전체 이메일 주소
            $mail->Password = '앱비밀번호'; // 일반 비번 아님! 
            $mail->SMTPSecure = 'ssl';
            $mail->Port = 465;
            $mail->Timeout = 30; // 타임아웃 설정 추가
            $mail->SMTPKeepAlive = true; // 연결 유지 옵션
            $mail->From = '*** 개인정보보호를 위한 이메일주소 노출방지 ***'; // 보내는 주소도 동일하게
            $mail->FromName = 'your name';
        }
로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

네~ 상세한 답변감사 드립니다. 이렇게 SMTP를 사용해서 발송하면 메일함수나 send_mail을 허용 안하는 웹호스팅에서도 사용가능한 소스일까요?
채택 감사 합니다.
네 제가 그렇게 사용하고 있습니다.

댓글을 작성하려면 로그인이 필요합니다.

Great guide for configuring Naver SMTP in GnuBoard! Ensure your hosting allows outbound connections on port 465. Double-check your Naver app password and email address are correct. Sometimes a simple Retro Bowl break helps debugging! Have you tried other SMTP ports (like 587 with TLS)? Also, confirm your server's firewall isn't blocking the connection.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

Great guide for configuring Naver SMTP in GnuBoard! Ensure your hosting allows outbound connections on port 465. Double-check your Naver app password and email address are correct. Sometimes a simple Retro Bowl break helps debugging! Have you tried other SMTP ports (like 587 with TLS)? Also, confirm your server's firewall isn't blocking the connection.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

내가 쓰는 방식으로 팁공유해놓았으니 참고해보시기 바랍니다.

https://sir.kr/g5_tip/24293?autosave_clear=1

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고