폼메일이 안됩니다...
본문
안녕하세요 폼메일이 안되서 문의드립니다...
닷홈쪽에 문의하였는데도 해결이 안되서 문의드립니다.
mailer.li.php 소스는 건든게 없구요..
기본 디폴트 값입니다.
예전에 만들었던
http://kimtaeyoung.co.kr/contact.html 에서는 같은 소스로 하여서 메일 테스트 잘하였는데요
그누보드 업데이트버전으로 깔고나서는 다른사이트에 입히는데 메일이 안옵니다..
아무리해도 안되서 문의드립니다 ㅠ
적용사이트
http://humphreys123.dothome.co.kr/sub/04.phpphp
<?
//include_once("./_common.php");
//include_once(G5_LIB_PATH."/latest.lib.php");
//include_once("../_head.php");
include_once('./_common.php');
include_once('../lib/mailer.lib.php');
include_once('../head.php');
if ($mail) {
check_token();
$from_name = "$name";
$from_email = "$gbeovhs";
$email = explode(",", $mail);
$sub = "$name, $gbeovhs, $phone, $pay, $memo";
for ($i=0; $i<count($email); $i++)
mailer($from_name, $from_email, trim($email[$i]), "문의", $sub);
echo <<<HEREDOC
<SCRIPT type="text/javascript">
alert("메일발송 완료 되었습니다.");
</SCRIPT>
HEREDOC;
}
$token = get_token();
?>
<h3>Contact Us</h3>
<div class="sub_04">
<form name=fsendmailtest method=post>
<input type=hidden name=token value='<?=$token?>'>
<p>Name (required)</p>
<input type="text" name="name" size='10'>
<p>Email (required)</p>
<input type="text" name="gbeovhs" size='30' required itemname='이메일'>
<p>Questions and Comments (required)</p>
<textarea name="memo" id="content" cols="30" rows="10"></textarea>
<input type=text class=ed name=mail size=30 required itemname="E-mail" value="*** 개인정보보호를 위한 이메일주소 노출방지 ***" style="display:none">
<input type="submit" value="Submit">
</form>
</div>
<?
include_once("../_tail.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(); // 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 = ""; // 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;
}
?>