3) {
alert_close('폼메일 발송 횟수를 초과하였습니다.');
}
$email_enc = new str_encrypt();
$to = $email_enc->decrypt($to);
if (!chk_captcha()) {
alert('자동등록방지 숫자가 틀렸습니다.');
}
if (!preg_match("/([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/", $to)){
alert_close('E-mail 주소가 형식에 맞지 않아서, 메일을 보낼수 없습니다.');
}
$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", "
", $content);
}
// html 이면
if ($type) {
$current_url = G5_URL;
$mail_content = '
메일보내기'.$content.'';
}
else
$mail_content = $content;
// 발신자 정보 서버측 강제 설정
$reply_to_email = '';
if ($is_member) {
$fnick = (isset($member['mb_nick']) && $member['mb_nick']) ? $member['mb_nick'] : $member['mb_name'];
$fmail = $member['mb_email'];
} else {
// 비회원: From을 관리자 이메일로 고정 (발신자 위장 방지)
// 비회원이 입력한 이메일은 Reply-To로 설정하여 회신 기능 유지
$user_email = get_email_address(trim($fmail));
$fnick = strip_tags(trim($fnick));
$fmail = $config['cf_admin_email'];
if ($user_email) {
$reply_to_email = $user_email;
}
}
mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file, '', '', $reply_to_email);
// 임시 첨부파일 삭제
if(!empty($file)) {
foreach($file as $f) {
@unlink($f['path']);
}
}
//$html_title = $tmp_to . "님께 메일발송";
$html_title = '메일 발송중';
include_once(G5_PATH.'/head.sub.php');
alert_close('메일을 정상적으로 발송하였습니다.');
include_once(G5_PATH.'/tail.sub.php');