phpmailer가 작동하지 않습니다.
본문
phpmailer 부분을 건드렸는데, phpmailer가 작동하지 않고 있습니다.
mailer.lib.php 코드입니다.(daum 스마트워크 사용중입니다)
<?php
if (!defined('_GNUBOARD_')) exit;
include_once(G5_PLUGIN_PATH.'/PHPMailer/PHPMailerAutoload.php');
// 메일 보내기 (파일 여러개 첨부 가능)
// type : text=0, html=1, text+html=2
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->IsSMTP();
$mail->SMTPSecure = "ssl";
$mail->SMTPAuth = true;
$mail->Host = "smtp.daum.net";
$mail->Port = 465;
$mail->Username = "noreply%mailer.choyunjin.kr";
$mail->Password = "비번입니다";
$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']);
}
}
$res = $mail->send();
echo $mail->ErrorInfo;
return $res;
}
// 파일을 첨부함
function attach_file($filename, $tmp_name)
{
// 서버에 업로드 되는 파일은 확장자를 주지 않는다. (보안 취약점)
$dest_file = G5_DATA_PATH.'/tmp/'.str_replace('/', '_', $tmp_name);
move_uploaded_file($tmp_name, $dest_file);
$tmpfile = array("name" => $filename, "path" => $dest_file);
return $tmpfile;
}
참고로 %는 원래 @였는데 메일주소가 가려져서 수정했습니다
위 코드를 어떻게 수정해야 되나요?
답변 1
mailer.choyunjin.kr
도메인이 정말 이것이라면...
혹시 화이트 메일 리스트(?) 맞나...
등록하셨는지요?
메일의 도메인이 알려진 것이 아닐 경우,
갑자기 또는 특정한 메일만... 스팸메일로 간주되어 버릴 수 있습니다.
(스마트워크라고 할지라도, 받은 쪽에서는 신경쓰지 않을겁니다.)
구글이나, 다음, 네이버 메일 계정으로 테스트를 해보시고
정상적으로 된다면 소스에는 문제가 없는것이니
메일이 스팸되고 있는지 여부를 의심하셔야 합니다.
답변을 작성하시기 전에 로그인 해주세요.