메일전송시 내용이 화면에 출력됩니다.

메일전송시 내용이 화면에 출력됩니다.

QA

메일전송시 내용이 화면에 출력됩니다.

답변 2

본문

안녕하세요.

메일전송시 페이지에 메일전송 정보 (서버및 시간 내용 등이 표시가됩니다.)

소스중에 출력하는 코드는 없는거같은데 어디부분에서 저런게 나오는지 문의드립니다.

 

캡쳐화면은 mail_send.php파일입니다.

2038638456_1530594734.5636.png

mail_send.php



<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/mailer.lib.php');
 

//$email_enc = new str_encrypt();
//$to = $email_enc->decrypt($to);
$file = array();
for ($i=1; $i<=$attach; $i++) {
    if ($_FILES['file'.$i]['name'])
        $file[] = attach_file($_FILES['file'.$i]['name'], $_FILES['file'.$i]['tmp_name']);
}
 

$content = stripslashes($content);
if ($type == 2) {
    $type = 1;
    $content = str_replace("\n", "<br>", $content);
}
 

mailer($fname, $fmail, $to, $subject, $message, $type, $file);
 

// 임시 첨부파일 삭제
if(!empty($file)) {
    foreach($file as $f) {
        @unlink($f['path']);
    }
}
 

//$html_title = $tmp_to . "님께 메일발송";
//$html_title = '메일 발송중';
//include_once(G5_PATH.'/head.sub.php');
if($apply){
    alert('이력서가 접수 되었습니다',G5_BBS_URL.'/board.php?bo_table=apply');
}else if($qa){
    alert('메일을 정상적으로 발송하였습니다.',G5_URL.'/qa.php');
}else if($qa_en){
    alert('메일을 정상적으로 발송하였습니다.',G5_URL.'/qa_en.php');
}else{
    alert('메일을 정상적으로 발송하였습니다.',G5_URL.'/map.php');
}
 

//include_once(G5_PATH.'/tail.sub.php');
?>

 

mailer.lib.php



<?php
if (!defined('_GNUBOARD_')) exit;
 

include_once(G5_PHPMAILER_PATH.'/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();
        $mail->SMTPDebug = 2;
        $mail->SMTPSecure = "ssl";
        $mail->SMTPAuth = true;
        $mail->Host = "smtp.daum.net";
        $mail->Port = 465;
        $mail->Username = "**********";
        $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);
    if ($file != "") {
        foreach ($file as $f) {
            $mail->addAttachment($f['path'], $f['name']);
        }
    }
    return $mail->send();
}
 

// 파일을 첨부함
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;
}
?>

이 질문에 댓글 쓰기 :

답변 2

메일보내는 서버와 받는 서버간에 주고 받는 데이터로 보이는데

잘될지는 모르겠지만

일단은 아래 처럼 골뱅이를 붙이고 시도해 보시죠. 잘될것 같지는 않지만......

@mailer($fname, $fmail, $to, $subject, $message, $type, $file);

오래전 질문내용이라 채택은 모르겠지만, 저도 이부분때매 이거저거 해봤다가 해결되서 남깁니다.

 

mailer.lib.php 보시면,

$mail->SMTPDebug = 2; 

 

SMTPDebug 디버그 모드가 2로 설정되어 있습니다.

 

디버그 모드

     * * `0` No output
     * * `1` Commands
     * * `2` Data and commands
     * * `3` As 2 plus connection status
     * * `4` Low-level data output

 

0 으로 설정하시면 해당 메일 발송한 정보에 대한 디버그 내용이 출력되지 않습니당.

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
filter #mail ×
전체 20
© SIRSOFT
현재 페이지 제일 처음으로