글 등록시 메일 받기 문제
본문
안녕 하세요
문의 드립니다. 이용 하고 있는 사이트에서 폼메일 형식으로 글이 등록 되면 관리자 게시판에서 확인이 가능 하고, 또 설정된 메일로 알림 메일이 옵니다.
그런데 관리자 메뉴에서는 전화번호가 나오는데 메일에는 전화번호가 없어 수정을 하는데 안되네요.
소스 코드를 열어 수정을 하는데 적용이 안되네요. ㅠㅠ
입력항목:
이름,
이메일,
전화번호,
제목,
내용,
관리자 메뉴에는 정상으로 전화번호 나옴.
이메일(아웃룩)에서 본 경우.
한번 봐 주시면 감사 하겠습니다.
write_update_skin.php
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/mailer.lib.php');
$fnick = $wr_name;
$type = 2;
$subject = $wr_subject;
$AltBody = $wr_1;
$content = stripslashes($wr_content);
if ($type == 2) {
$type = 1;
$content = str_replace("\n", "<br>", $content);
$AltBody;
}
// html 이면
if ($type) {
$current_url = G5_URL;
$mail_content = '<!doctype html><html lang="ko"><head><meta charset="utf-8"><title>메일보내기</title><link rel="stylesheet" href="'.$current_url.'/style.css"></head><body>'.$content.'</body></html>
mailer.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, $ptel, $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->From = $fmail;
$mail->FromName = $fname;
$mail->Subject = $subject;
$mail->AltBody = $ptel; // 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();
}
// 파일을 첨부함
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
현재는 textarea내용만 메일로 발송되게 제작되어있습니다.
하기 부분에 전화번호 추가해서 html 짜보세요
$mail_content = '<!doctype html><html lang="ko"><head><meta charset="utf-8"><title>메일보내기</title><link rel="stylesheet" href="'.$current_url.'/style.css"></head><body>'.$content.'</body></html>
설정에 의한 메일발송은 스킨적용이전에 메일을 발송하기때문에 발송내용의 수정이 필요하다면 별도로 처리하셔야됩니다.
위에 첨부해주신 내용만으로는 $mail_content 내용을 보내실려는 목적이신것 같은데 게시물 내용만 기재되어 있습니다.
// 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면
if (strstr($wr['wr_option'], 'mail') && $wr['wr_email'])
$array_email[] = $wr['wr_email'];
// 중복된 메일 주소는 제거
$unique_email = array_unique($array_email);
$unique_email = run_replace('write_update_mail_list', array_values($unique_email), $board, $wr_id);
for ($i=0; $i<count($unique_email); $i++) {
mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1);
}
}
// 사용자 코드 실행
@include_once($board_skin_path.'/write_update.skin.php');
!-->