메일테스트 Network is unreachable (101)이라고뜨며 안됩니다.
본문
2017-02-18 05:23:42 SMTP ERROR: Failed to connect to server: Network is unreachable (101) 2017-02-18 05:23:42 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
디버그내용입니다.
smtp.gmail.com 로 사용하고있고 포트는 465입니다.
config.php----------------
// SMTP
// lib/mailer.lib.php 에서 사용
//define('G5_SMTP', '127.0.0.1');
define('G5_SMTP', 'smtp.gmail.com');
define('G5_SMTP_PORT', '465');
mailer.lib.php----------------
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;
}
$mail->CharSet = 'UTF-8';
$mail->SMTPDebug = 2;
$mail->From = $fmail;
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->FromName = $fname;
$mail->Subject = $subject;
$mail->AltBody = ""; // optional, comment out and test
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->msgHTML($content);
$mail->addAddress($to);
$mail->Username="제꺼이메일입니다.";
$mail->Password="*************";
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();
}
뭐가잘못됬을까요? 호스팅은닷홈에서하고 새벽까지잘되다가 닷홈점검이었는데
점검끝나고 갑자기안되네요.
포트 465 25 587 다써봤는데도 안됩니다.