묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
폼메일을 홈페이지에 달려고 합니다.
성공은 했는데, 한가지 고민이 생겨서 글을 올려요.
다름이 아니라, 받는 메일이 저에게만 올 수 있도록 주소를 고정하고 싶습니다.
그런데 어떤것을 고쳐야 할 지 모르겠네요.
아래쪽은 그 소스구요. 물론 별은 뺍니다^^
모쪼록 아시는 분은 꼭 도와주셨음 좋겠어요. 부탁드립니다.
그럼 오늘도 좋은하루 되세요!
<★html>
<★head>
<★meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>
<★STYLE TYPE="text/css">
<★!--
A:link {text-decoration:none; color:darkblue}
A:visited{text-decoration:none; color:663399}
A:hover {text-decoration:none; color:red}
A:active {text-decoration:none; color:red}
td {font-size:9pt}
-->
<★/STYLE>
<★/head>
<★body bgcolor='#FFFFFF'>
<★center>
<★?
// Sendmail 폼
if(!$mailsend)
{
?>
<★/center>
<★form method='post' enctype='multipart/form-data' action='index.php?mailsend=send'>
<★p style="line-height:100%; margin-top:0; margin-bottom:0;" align="center"><★img src="images/h1.gif" width="400" height="25" border="0"><★center>
<★table width="399" border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC" >
<★tr>
<★td width="42" align="left" nowrap bgcolor="#EAEAEA">
<★tt> 이 름<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="347">
<★font><★/font>
<★/td>
<★/tr>
<★tr>
<★td width="42" align="left" nowrap bgcolor="#EAEAEA">
<★tt><★span style="font-size:9pt;"><★font face="굴림체"> 메 일<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="347">
<★font><★input name=to size="48" style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★/table>
<★p style="line-height:100%; margin-top:0; margin-bottom:0;" align="center"><★img src="images/h2.gif" width="400" height="25" border="0"><★center>
<★table width="398" border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC" >
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★tt><★span style="font-size:9pt;"> 이 름<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★font><★/font>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★tt> 메 일<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★font>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★p style="line-height:100%; margin-top:0; margin-bottom:0;"><★tt><★span style="font-size:9pt;"><★font face="굴림체"> 제 목<★/font><★/span>
<★/td>
<★td align="left" width="348">
<★ p style="line-height:100%; margin-top:0; margin-bottom:0;"><★ font><★input name=subject size="48" style="border-color:rgb(204,204,204); border-style:none;"><★/font>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★tt> 내 용<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★textarea name=message rows="14" cols="46" style="border-color:rgb(204,204,204); border-style:none;"><★/textarea>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA" rowspan="3" height="63">
<★tt><★span style="font-size:9pt;"> 첨 부<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★input type=file size="34" name=userfile style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★tr>
<★td align="left" width="348">
<★input type=file size="34" name=userfile2 style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★tr>
<★td align="left" width="348" height="9">
<★input type=file size="34" name=userfile3 style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★tr>
<★td colspan=2 align=center width="392" bgcolor="white">
<★input type=submit name=submit value='메일전송' style="background-color:white; border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★/table>
<★/form>
<★tt><★span style="font-size:9pt;"><★font face="굴림체">Copyright 2002' Bell5Works
allreserved. Bell5Works-sendmail_v1.0<★/font><★/span><★/tt><★/center>
<★p>
}
// 메일 프로그램 시작
if($mailsend==send)
{
// 에러
if(!$to || !$subject)
{
echo("
<★script>
window.alert('받는 사람의 메일주소나 제목은 반드시 입력해 주시기 바랍니다.')
history.go(-1)
<★/script>
");
}
else
{
// 받는 사람 처리
$to = $to_name." <★".$to.">";
// 헤더부분
$mailheader .= "Return-Path: $fromrn";
$mailheader .= "From: $from_name <$from>rn";
$mailheader .= "X-Mailer: Gfew Interfacern";
// 첨부화일이 3개일경우
if ($userfile && $userfile_size && $userfile2 && $userfile2_size && $userfile3 && $userfile3_size)
{
$filename=basename($userfile_name);
$fp = fopen($userfile,"r");
$file = fread($fp,$userfile_size);
fclose($fp);
$filename2=basename($userfile2_name);
$fp2 = fopen($userfile2,"r");
$file2 = fread($fp2,$userfile2_size);
fclose($fp2);
$filename3=basename($userfile3_name);
$fp3 = fopen($userfile3,"r");
$file3 = fread($fp3,$userfile3_size);
fclose($fp3);
if ($userfile_type == "" && $userfile2_type == "" && $userfile3_type == "")
{
$userfile_type = "application/octet-stream";
$userfile2_type = "application/octet-stream";
$userfile3_type = "application/octet-stream";
}
$boundary = "--------" . uniqid("part");
$mailheader .= "MIME-Version: 1.0rn";
$mailheader .= "Content-Type: multipart/mixed; boundary="$boundary"";
$messages = "This is a multi-part message in MIME format.rnrn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: text/html; charset=euc-krrn";
$messages .= "Content-Transfer-Encoding: 8bitrnrn";
$messages .= nl2br(addslashes($message)) . "rn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: $userfile_type; name="$filename"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file));
$messages .= "rn--$boundary" . "rn";
$messages .= "Content-Type: $userfile2_type; name="$filename2"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file2));
$messages .= "rn--$boundary" . "rn";
$messages .= "Content-Type: $userfile3_type; name="$filename3"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file3));
$messages .= "rn--$boundary" . "rn";
}
//첨부화일이 2개일경우
elseif ($userfile && $userfile_size && $userfile2 && $userfile2_size)
{
$filename=basename($userfile_name);
$fp = fopen($userfile,"r");
$file = fread($fp,$userfile_size);
fclose($fp);
$filename2=basename($userfile2_name);
$fp2 = fopen($userfile2,"r");
$file2 = fread($fp2,$userfile2_size);
fclose($fp2);
if ($userfile_type == "" && $userfile2_type == "")
{
$userfile_type = "application/octet-stream";
$userfile2_type = "application/octet-stream";
}
$boundary = "--------" . uniqid("part");
$mailheader .= "MIME-Version: 1.0rn";
$mailheader .= "Content-Type: multipart/mixed; boundary="$boundary"";
$messages = "This is a multi-part message in MIME format.rnrn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: text/html; charset=euc-krrn";
$messages .= "Content-Transfer-Encoding: 8bitrnrn";
$messages .= nl2br(addslashes($message)) . "rn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: $userfile_type; name="$filename"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file));
$messages .= "rn--$boundary" . "rn";
$messages .= "Content-Type: $userfile2_type; name="$filename2"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file2));
$messages .= "rn--$boundary" . "rn";
}
//첨부화일이 1개일경우
elseif($userfile && $userfile_size)
{
$filename=basename($userfile_name);
$fp = fopen($userfile,"r");
$file = fread($fp,$userfile_size);
fclose($fp);
if ($userfile_type == "")
{
$userfile_type = "application/octet-stream";
}
$boundary = "--------" . uniqid("part");
$mailheader .= "MIME-Version: 1.0rn";
$mailheader .= "Content-Type: multipart/mixed; boundary="$boundary"";
$messages = "This is a multi-part message in MIME format.rnrn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: text/html; charset=euc-krrn";
$messages .= "Content-Transfer-Encoding: 8bitrnrn";
$messages .= nl2br(addslashes($message)) . "rn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: $userfile_type; name="$filename"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file));
$messages .= "rn--$boundary" . "rn";
}
//첨부화일이 없을경우
else
{
$mailheader .= "Content-Type: text/html; charset=euc-krrn";
$mailheader .= "Content-Transfer-Encoding: 8bitrnrn";
$messages = $mail_head."rn";
$messages .= nl2br(addslashes($message))."rn";
$messages .= $mail_tail."rn";
}
mail($to,$subject,$messages,$mailheader);
echo("
");
}
}
// 메일 전송
if($mailsend==choice)
{
echo("
<★table width=$table_width border=0>
<★tr>
<★td height=20>
폼메일에서 받는사람 고정?!
2004.01.30 11:46
폼메일을 홈페이지에 달려고 합니다.
성공은 했는데, 한가지 고민이 생겨서 글을 올려요.
다름이 아니라, 받는 메일이 저에게만 올 수 있도록 주소를 고정하고 싶습니다.
그런데 어떤것을 고쳐야 할 지 모르겠네요.
아래쪽은 그 소스구요. 물론 별은 뺍니다^^
모쪼록 아시는 분은 꼭 도와주셨음 좋겠어요. 부탁드립니다.
그럼 오늘도 좋은하루 되세요!
<★html>
<★head>
<★meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>
<★STYLE TYPE="text/css">
<★!--
A:link {text-decoration:none; color:darkblue}
A:visited{text-decoration:none; color:663399}
A:hover {text-decoration:none; color:red}
A:active {text-decoration:none; color:red}
td {font-size:9pt}
-->
<★/STYLE>
<★/head>
<★body bgcolor='#FFFFFF'>
<★center>
<★?
// Sendmail 폼
if(!$mailsend)
{
?>
<★/center>
<★form method='post' enctype='multipart/form-data' action='index.php?mailsend=send'>
<★p style="line-height:100%; margin-top:0; margin-bottom:0;" align="center"><★img src="images/h1.gif" width="400" height="25" border="0"><★center>
<★table width="399" border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC" >
<★tr>
<★td width="42" align="left" nowrap bgcolor="#EAEAEA">
<★tt> 이 름<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="347">
<★font><★/font>
<★/td>
<★/tr>
<★tr>
<★td width="42" align="left" nowrap bgcolor="#EAEAEA">
<★tt><★span style="font-size:9pt;"><★font face="굴림체"> 메 일<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="347">
<★font><★input name=to size="48" style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★/table>
<★p style="line-height:100%; margin-top:0; margin-bottom:0;" align="center"><★img src="images/h2.gif" width="400" height="25" border="0"><★center>
<★table width="398" border="1" cellspacing="0" bordercolor="#CCCCCC" bordercolordark="white" bordercolorlight="#CCCCCC" >
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★tt><★span style="font-size:9pt;"> 이 름<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★font><★/font>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★tt> 메 일<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★font>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★p style="line-height:100%; margin-top:0; margin-bottom:0;"><★tt><★span style="font-size:9pt;"><★font face="굴림체"> 제 목<★/font><★/span>
<★/td>
<★td align="left" width="348">
<★ p style="line-height:100%; margin-top:0; margin-bottom:0;"><★ font><★input name=subject size="48" style="border-color:rgb(204,204,204); border-style:none;"><★/font>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA">
<★tt> 내 용<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★textarea name=message rows="14" cols="46" style="border-color:rgb(204,204,204); border-style:none;"><★/textarea>
<★/td>
<★/tr>
<★tr>
<★td width="40" align="left" nowrap bgcolor="#EAEAEA" rowspan="3" height="63">
<★tt><★span style="font-size:9pt;"> 첨 부<★/font><★/span><★/tt>
<★/td>
<★td align="left" width="348">
<★input type=file size="34" name=userfile style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★tr>
<★td align="left" width="348">
<★input type=file size="34" name=userfile2 style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★tr>
<★td align="left" width="348" height="9">
<★input type=file size="34" name=userfile3 style="border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★tr>
<★td colspan=2 align=center width="392" bgcolor="white">
<★input type=submit name=submit value='메일전송' style="background-color:white; border-color:rgb(204,204,204); border-style:none;">
<★/td>
<★/tr>
<★/table>
<★/form>
<★tt><★span style="font-size:9pt;"><★font face="굴림체">Copyright 2002' Bell5Works
allreserved. Bell5Works-sendmail_v1.0<★/font><★/span><★/tt><★/center>
<★p>
}
// 메일 프로그램 시작
if($mailsend==send)
{
// 에러
if(!$to || !$subject)
{
echo("
<★script>
window.alert('받는 사람의 메일주소나 제목은 반드시 입력해 주시기 바랍니다.')
history.go(-1)
<★/script>
");
}
else
{
// 받는 사람 처리
$to = $to_name." <★".$to.">";
// 헤더부분
$mailheader .= "Return-Path: $fromrn";
$mailheader .= "From: $from_name <$from>rn";
$mailheader .= "X-Mailer: Gfew Interfacern";
// 첨부화일이 3개일경우
if ($userfile && $userfile_size && $userfile2 && $userfile2_size && $userfile3 && $userfile3_size)
{
$filename=basename($userfile_name);
$fp = fopen($userfile,"r");
$file = fread($fp,$userfile_size);
fclose($fp);
$filename2=basename($userfile2_name);
$fp2 = fopen($userfile2,"r");
$file2 = fread($fp2,$userfile2_size);
fclose($fp2);
$filename3=basename($userfile3_name);
$fp3 = fopen($userfile3,"r");
$file3 = fread($fp3,$userfile3_size);
fclose($fp3);
if ($userfile_type == "" && $userfile2_type == "" && $userfile3_type == "")
{
$userfile_type = "application/octet-stream";
$userfile2_type = "application/octet-stream";
$userfile3_type = "application/octet-stream";
}
$boundary = "--------" . uniqid("part");
$mailheader .= "MIME-Version: 1.0rn";
$mailheader .= "Content-Type: multipart/mixed; boundary="$boundary"";
$messages = "This is a multi-part message in MIME format.rnrn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: text/html; charset=euc-krrn";
$messages .= "Content-Transfer-Encoding: 8bitrnrn";
$messages .= nl2br(addslashes($message)) . "rn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: $userfile_type; name="$filename"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file));
$messages .= "rn--$boundary" . "rn";
$messages .= "Content-Type: $userfile2_type; name="$filename2"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file2));
$messages .= "rn--$boundary" . "rn";
$messages .= "Content-Type: $userfile3_type; name="$filename3"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file3));
$messages .= "rn--$boundary" . "rn";
}
//첨부화일이 2개일경우
elseif ($userfile && $userfile_size && $userfile2 && $userfile2_size)
{
$filename=basename($userfile_name);
$fp = fopen($userfile,"r");
$file = fread($fp,$userfile_size);
fclose($fp);
$filename2=basename($userfile2_name);
$fp2 = fopen($userfile2,"r");
$file2 = fread($fp2,$userfile2_size);
fclose($fp2);
if ($userfile_type == "" && $userfile2_type == "")
{
$userfile_type = "application/octet-stream";
$userfile2_type = "application/octet-stream";
}
$boundary = "--------" . uniqid("part");
$mailheader .= "MIME-Version: 1.0rn";
$mailheader .= "Content-Type: multipart/mixed; boundary="$boundary"";
$messages = "This is a multi-part message in MIME format.rnrn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: text/html; charset=euc-krrn";
$messages .= "Content-Transfer-Encoding: 8bitrnrn";
$messages .= nl2br(addslashes($message)) . "rn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: $userfile_type; name="$filename"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file));
$messages .= "rn--$boundary" . "rn";
$messages .= "Content-Type: $userfile2_type; name="$filename2"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file2));
$messages .= "rn--$boundary" . "rn";
}
//첨부화일이 1개일경우
elseif($userfile && $userfile_size)
{
$filename=basename($userfile_name);
$fp = fopen($userfile,"r");
$file = fread($fp,$userfile_size);
fclose($fp);
if ($userfile_type == "")
{
$userfile_type = "application/octet-stream";
}
$boundary = "--------" . uniqid("part");
$mailheader .= "MIME-Version: 1.0rn";
$mailheader .= "Content-Type: multipart/mixed; boundary="$boundary"";
$messages = "This is a multi-part message in MIME format.rnrn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: text/html; charset=euc-krrn";
$messages .= "Content-Transfer-Encoding: 8bitrnrn";
$messages .= nl2br(addslashes($message)) . "rn";
$messages .= "--$boundaryrn";
$messages .= "Content-Type: $userfile_type; name="$filename"rn";
$messages .= "Content-Transfer-Encoding: base64rnrn";
$messages .= ereg_replace("(.{80})","\1rn",base64_encode($file));
$messages .= "rn--$boundary" . "rn";
}
//첨부화일이 없을경우
else
{
$mailheader .= "Content-Type: text/html; charset=euc-krrn";
$mailheader .= "Content-Transfer-Encoding: 8bitrnrn";
$messages = $mail_head."rn";
$messages .= nl2br(addslashes($message))."rn";
$messages .= $mail_tail."rn";
}
mail($to,$subject,$messages,$mailheader);
echo("
");
}
}
// 메일 전송
if($mailsend==choice)
{
echo("
<★table width=$table_width border=0>
<★tr>
<★td height=20>
댓글 4
-
티다
2004.01.30 17:15
-
티다
2004.01.30 17:17
아니면 폼태그 안에 <input type=hidden name=to value=메일주소> 하셔도 되구요.
(그러니까 있는데도 없는것 처럼 보이는 상술이라고 할 수 있죠.) -
foxfla
2004.01.30 18:19
저 죄송한데 어디에다가 넣어야 한다는 말인가요^^
(두번째것은.. 멜 주소를 가리지는 않을 거라서요//) -
티다
2004.01.30 19:12
받는 사람 있는 input 소스 맨 뒤에 그냥 readonly 붙여주시면 되요. ^^
<input name=to size=사이즈 maxlength=최대글제한 readonly> 하세요.
disabled하면 입력하세요 나옵니다. -_-; (경험자)