네이버 SMTP 발신자 설정 문의

네이버 SMTP 발신자 설정 문의

QA

네이버 SMTP 발신자 설정 문의

본문

안녕하세요.
formmail
네이버 SMTP 설정중

 

작성한 이메일을 발신자 이메일로 사용하려합니다


<?php
$config['use_smtp']    = true;    
// SMTP Server Settings
$config['smtp_host']    = 'smtp.naver.com';  
$config['smtp_port']    = 465;      
$config['smtp_user']    = '****';
$config['smtp_pass']    = '****';   
$config['smtp_ssl']    = true;     
$config['send_to']    = '****';   
// Email Subject
$config['subject']    = '온라인 문의'; // subject of emails you receive
?>

 


  // SMTP ENABLED [isset = for old versions]
  if(!isset($config['use_smtp']) || isset($config['use_smtp']) && $config['use_smtp'] === true) {
   require('http://******/html/formmail/php/phpmailer/5.1/class.phpmailer.php');
   $m = new PHPMailer();
   $m->IsSMTP();
   $m->SMTPDebug   = false;     // enables SMTP debug information (for testing) [default: 2]
   $m->SMTPAuth    = true;      // enable SMTP authentication
   $m->Host        = $config['smtp_host'];  // sets the SMTP server
   $m->Port        = $config['smtp_port'];  // set the SMTP port for the GMAIL server
   $m->Username    = $config['smtp_user'];  // SMTP account username
   $m->Password    = $config['smtp_pass'];  // SMTP account password
   $m->SingleTo    = true;
   $m->CharSet     = "UTF-8";
   $m->Subject  = $array['contact_subject'];
   $m->AltBody  = 'To view the message, please use an HTML compatible email viewer!';
   $m->AddAddress($config['send_to'], '온라인 문의');
   $m->AddReplyTo($array['contact_email'], $array['contact_name']);
   $m->SetFrom($config['smtp_user'], '온라인 문의');
   $m->MsgHTML($mail_body);
   if($config['smtp_ssl'] === true)
    $m->SMTPSecure = 'ssl';     // sets the prefix to the server
   // @SEND MAIL
   if($m->Send()) {
    die('_sent_ok_');
   } else {
    die($m->ErrorInfo);
   }
   unset($array, $m);
  }
  // mail()
  else {
   // mail( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
   mail($config['send_to'] ,$array['contact_subject'],$mail_body);
  }
 }

위의 코드로 작성하였으나 보내는 사람메일이 smtp 계정 이메일이 아닌경우 에러가 나네요..

 

The following From address failed: @gmail.com
The following From address failed: @gmail.com<p>SMTP server error: 5.7.1 The sender address is unauthorized UQDKtTKpTHyPd5JD9GzyLA - nsmt

이 질문에 댓글 쓰기 :

답변 1

보내는 사람메일이 smtp 계정 이메일이 아닌경우 에러가 나네요  >>> smpt 로그인을 해야 하니까 계정이 아니면 로그인이 안되죠. 에러는 당연할것 같네요.

답변을 작성하시기 전에 로그인 해주세요.
전체 1,010
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT