테스트 사이트 - 개발 중인 베타 버전입니다

PHPMailer 질문합니다. 채택완료

판다렌 5년 전 조회 6,785

다음 스마트워크를 이용해서 그누보드5의 각종 이메일 기능을 사용하려고 하는데요, 애저 웹 앱에서 잘 작동하던 것을 확인한 설정파일을 그대로 제 컴퓨터 서버에 올렸더니 서버에 연결할 수 없다는 오류 메시지가 뜹니다.

윈도 방화벽과 공유기 포트포워드는 TCP 25, 465, 587, 993, 995 포트에 대해 양방향 모두 개방하였습니다.

왜 안되는걸까요?

 

아래는 다음에서 제시한 연결 방법입니다.

 

아래는 mailer.lib.php의 mailer 함수 부분의 코드입니다.

// 메일 보내기 (파일 여러개 첨부 가능)</p>

<p>// type : text=0, html=1, text+html=2</p>

<p>function mailer($fname, $fmail, $to, $subject, $content, $type=2, $file="", $cc="", $bcc="")</p>

<p>{</p>

<p>    global $config;</p>

<p>    global $g5;</p>

<p> </p>

<p>    // 메일발송 사용을 하지 않는다면</p>

<p>    if (!$config['cf_email_use']) return;</p>

<p> </p>

<p>    if ($type != 1)</p>

<p>        $content = nl2br($content);</p>

<p> </p>

<p>    $mail = new PHPMailer(); // defaults to using php "mail()"</p>

<p>    /* if (defined('G5_SMTP') && G5_SMTP) {</p>

<p>        $mail->IsSMTP(); // telling the class to use SMTP</p>

<p>        $mail->Host = G5_SMTP; // SMTP server</p>

<p>        if(defined('G5_SMTP_PORT') && G5_SMTP_PORT)</p>

<p>            $mail->Port = G5_SMTP_PORT;</p>

<p>    } */</p>

<p>    $mail->IsSMTP();</p>

<p>    $mail->SMTPDebug = 4;</p>

<p>    $mail->SMTPSecure = "ssl";</p>

<p>    $mail->SMTPAuth = true;</p>

<p>    $mail->Host = "smtp.daum.net";</p>

<p>    $mail->Port = 465;</p>

<p>    $mail->Username = "다음 아이디";</p>

<p>    $mail->Password = "카카오계정 비밀번호";</p>

<p>    $mail->CharSet = 'UTF-8';</p>

<p>    $mail->From = "pdmnu@pdmnu.com";</p>

<p>    $mail->FromName = "판다모니엄";</p>

<p>    $mail->Subject = $subject;</p>

<p>    $mail->AltBody = ""; // optional, comment out and test</p>

<p>    $mail->msgHTML($content);</p>

<p>    $mail->addAddress($to);</p>

<p>    if ($cc)</p>

<p>        $mail->addCC($cc);</p>

<p>    if ($bcc)</p>

<p>        $mail->addBCC($bcc);</p>

<p>    //print_r2($file); exit;</p>

<p>    if ($file != "") {</p>

<p>        foreach ($file as $f) {</p>

<p>            $mail->addAttachment($f['path'], $f['name']);</p>

<p>        }</p>

<p>    }</p>

<p>    return $mail->send();</p>

<p>}

 

위와 같이 입력하였더니 발송 테스트에서 아래와 같은 오류 메시지가 출력되었습니다.

2019-12-06 05:08:13 Connection: opening to ssl://smtp.daum.net:465, timeout=300, options=array ( )</p>

<p>2019-12-06 05:08:13 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client() [<a href="<a href="https://www.php.net/manual/en/function.stream-socket-client" target="_blank" rel="noopener noreferrer">https://www.php.net/manual/en/function.stream-socket-client</a>">function.stream-socket-client</a>]: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed</p>

<p>2019-12-06 05:08:13 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client() [<a href="<a href="https://www.php.net/manual/en/function.stream-socket-client" target="_blank" rel="noopener noreferrer">https://www.php.net/manual/en/function.stream-socket-client</a>">function.stream-socket-client</a>]: Failed to enable crypto</p>

<p>2019-12-06 05:08:13 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client() [<a href="<a href="https://www.php.net/manual/en/function.stream-socket-client" target="_blank" rel="noopener noreferrer">https://www.php.net/manual/en/function.stream-socket-client</a>">function.stream-socket-client</a>]: unable to connect to ssl://smtp.daum.net:465 (Unknown error)</p>

<p>2019-12-06 05:08:13 SMTP ERROR: Failed to connect to server: (0)</p>

<p>2019-12-06 05:08:13 SMTP connect() failed. <a href="https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
" target="_blank" rel="noopener noreferrer">https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting[/code]

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

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

로그인