이메일이 안가서요. 도와주시면 감사하겠습니다. ㅠㅠ
본문
모든 메일이 안가서 지금 테스트 메일 보내기로 원인을 찾아보고 있는데요. ㅠㅠ
SMTPDebug = 2; 설정해서 오류메시지를 봤는데
2016-04-12 07:17:12 SMTP ERROR: Failed to connect to server: Network is unreachable (101) 2016-04-12 07:17:12 SMTP connect() failed.
이런 에러가 뜨더라구요.
제가 계속 검색해서 찾아보는데 왜 이런지 알수가 없네요.
SMTP 설정을
define('G5_SMTP', 'smtp.gmail.com');
define('G5_SMTP_PORT', '25');
mailer 함수는
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="")
{
global $config;
global $g5;
// 메일발송 사용을 하지 않는다면
if (!$config['cf_email_use']) return;
if ($type != 1)
$content = nl2br($content);
$mail = new PHPMailer(); // defaults to using php "mail()"
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;
}
//ADDED
$mail->SMTPDebug = 2; // enables SMTP debug information, 오류 메시지를 보기 위해서는 주석을 해제하고 2 로 설정할 것. 오류 메시지는 "회원메일발송 > 테스트" 버튼을 실행했을 때에만 나타남.
$mail->Username = "*** 개인정보보호를 위한 이메일주소 노출방지 ***"; // 계정 아이디
$mail->Password = "*********"; // 계정 암호
$mail->Encoding = "base64"; // 기본값이 8bit 이므로, base64로 변경함.
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Username = $fmail;
//-->
$mail->CharSet = 'UTF-8';
$mail->From = $fmail;
$mail->FromName = $fname;
$mail->Subject = $subject;
$mail->AltBody = ""; // optional, comment out and test
$mail->msgHTML($content);
$mail->addAddress($to);
if ($cc)
$mail->addCC($cc);
if ($bcc)
$mail->addBCC($bcc);
//print_r2($file); exit;
if ($file != "") {
foreach ($file as $f) {
$mail->addAttachment($f['path'], $f['name']);
}
}
return $mail->send();
}
이런 상태인데 뭐가 문제일까요?
아시는 분 대답 부탁드려요!!
답변 2
465번 포트(SSL/TLS 사용) 및 587번 포트(STARTTLS 사용)를 사용하도록 SMTP 서버를 구성했지만 여전히 메일을 보낼 수 없는 경우 25번 포트(SSL/TLS 사용)를 사용하여 SMTP를 구성해 보세요.
Apple Mail 사용자: 종종 메일의 SMTP 서버 설정이 다르게 해석되기도 합니다. 사용자의 설정에서 '발신 메일 서버:' 입력란에 현재 'smtp.gmail.com:*** 개인정보보호를 위한 이메일주소 노출방지 ***'으로 되어 있으면 그 입력란을 'smtp.gmail.com'으로 변경하고 설정을 저장하세요.
Gmail의 SMTP 포트는 587입니다.
답변을 작성하시기 전에 로그인 해주세요.