묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
폼메일을 만들었는데, 파일첨부기능은 어떻게 하는건지 모르겟네요ㅠㅠ
2006.10.29 19:47
고수님들 도와주세요~~~
파일첨부는 어떻게 만드나요????
=============
1. html로 메일 발송 폼
===================================================================
<★HTML>
<★HEAD>
<★TITLE>stylematin form-mail<★/TITLE>
<★META NAME="Generator" CONTENT="EditPlus">
<★META NAME="Author" CONTENT="">
<★META NAME="Keywords" CONTENT="">
<★META NAME="Description" CONTENT="">
<★/HEAD>
<★BODY>
<★form method='post' action='result.php'>
<★table width="1013" align="center">
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* 이름<★/span><★/td>
<★td width="929">
<★input type="text" name="name" maxlength="35" style="height:20; width:160" size="35"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">회사<★/span><★/td>
<★td width="929">
<★input type="text" name="company" maxlength="35" style="height:20; width:160" size="35"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">전화번호<★/span><★/td>
<★td width="929">
<★input name="tel" type="text" id="tel" size="26" maxlength="26"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">팩스번호<★/span><★/td>
<★td width="929">
<★input name="fax" type="text" id="tel" size="26" maxlength="26"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">이메일<★/span><★/td>
<★td width="929">
<★input type="text" name="email" maxlength="35" style="height:20; width:160" size="35"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">주소<★/span><★/td>
<★td width="929">
<★input type="text" name="ad" maxlength="100" style="height:20; width:300" size="51"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">품명<★/span><★/td>
<★td width="929">
<★input type="text" name="goods" maxlength="50" style="height:20; width:316" size="50"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">제목<★/span><★/td>
<★td width="929">
<★input type="text" name="subject" maxlength="50" style="height:20; width:316" size="50"><★/td>
<★/tr>
<★tr>
<★td height="172" align="center" bgcolor="white" width="73">
<★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">문의사항<★/span><★/td>
<★td height="172" width="929"><★textarea name="content" rows="13" cols="51"><★/textarea><★/td>
<★/tr>
<★tr>
<★td align="center" height="50" colspan="2" width="1007">
<★p align="left"> <★input name="submit" type="submit" style="font-family:굴림; font-size:9pt; background-color:white; border-width:1px; border-color:black; border-style:dashed; height:20px; width=50;" value="OK">
<★input name="reset" type="reset" style="font-family:굴림; font-size:9pt; background-color:white; border-width:1px; border-color:black; border-style:dashed; height:20px; width=50;" value="Cancel"><★/p>
<★/td>
<★/tr>
<★/table>
<★/form>
<★/BODY>
<★/HTML>
===================================================================
2. 발송하는 php코딩
===================================================================
<?
$tomail = "받는 사람 주소"; //이 폼메일을 받을 메일주소
function error($text){
echo "
<script language=javascript>
window.alert('$text')
history.go(-1)
</script>";
exit;
}
function msg($text){
echo "
<script language=javascript>
window.alert('$text')
top.location.href = 'http://itag.mireene.com/index.php'
</script>
";
exit;
}
if (!$name) {error('성명을 적어주세요');} // 이름이 없을때 에러 메세지
if (!$email) {error('메일 주소를 적어주세요');} // 메일주소가 없을때 에러 메세지
if (!$subject) {error('제목을 적어주세요');} // 제목이 없을때 에러 메세지
$mailheaders = "Return-Path: $email rn"; // 메일 헤더의 반송 메일 주소
$mailheaders .= "From: $name <$email>rn"; // 메일헤더의 이름과 메일 주소 표시
$body = " 이름 : $name rn";
$body .= " E-mail : $email rn";
$body = " 회사 : $company rn";
$body .= " TEL : $tel rn";
$body .= " FAX : $fax rn";
$body .= " 주소 : $ad rn";
$body .= " 품명 : $goods rn";
$body .= " 문의내용 : $content rn";
$result=mail($tomail , $subject , $body , $mailheaders); // 메일 전송
if($result) {msg('메일이 성공적으로 발송되었습니다.');} // 전송 성공시
else{error('메일 발송에 실패하였습니다.');} // 전송 실패시
?>
===================================================================
일단 메일은 즉각즉각 잘 가는데요.....파일첨부버튼 추가 해서 첨부를 좀 하고 싶어요~~~어떻게 해야되나요???
파일첨부는 어떻게 만드나요????
=============
1. html로 메일 발송 폼
===================================================================
<★HTML>
<★HEAD>
<★TITLE>stylematin form-mail<★/TITLE>
<★META NAME="Generator" CONTENT="EditPlus">
<★META NAME="Author" CONTENT="">
<★META NAME="Keywords" CONTENT="">
<★META NAME="Description" CONTENT="">
<★/HEAD>
<★BODY>
<★form method='post' action='result.php'>
<★table width="1013" align="center">
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* 이름<★/span><★/td>
<★td width="929">
<★input type="text" name="name" maxlength="35" style="height:20; width:160" size="35"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">회사<★/span><★/td>
<★td width="929">
<★input type="text" name="company" maxlength="35" style="height:20; width:160" size="35"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">전화번호<★/span><★/td>
<★td width="929">
<★input name="tel" type="text" id="tel" size="26" maxlength="26"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">팩스번호<★/span><★/td>
<★td width="929">
<★input name="fax" type="text" id="tel" size="26" maxlength="26"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">이메일<★/span><★/td>
<★td width="929">
<★input type="text" name="email" maxlength="35" style="height:20; width:160" size="35"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">주소<★/span><★/td>
<★td width="929">
<★input type="text" name="ad" maxlength="100" style="height:20; width:300" size="51"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">품명<★/span><★/td>
<★td width="929">
<★input type="text" name="goods" maxlength="50" style="height:20; width:316" size="50"><★/td>
<★/tr>
<★tr>
<★td align="center" height="22" width="73" bgcolor="white"> <★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">제목<★/span><★/td>
<★td width="929">
<★input type="text" name="subject" maxlength="50" style="height:20; width:316" size="50"><★/td>
<★/tr>
<★tr>
<★td height="172" align="center" bgcolor="white" width="73">
<★span style="font-size:8pt;">* <★/span><★span style="font-size:8pt;">문의사항<★/span><★/td>
<★td height="172" width="929"><★textarea name="content" rows="13" cols="51"><★/textarea><★/td>
<★/tr>
<★tr>
<★td align="center" height="50" colspan="2" width="1007">
<★p align="left"> <★input name="submit" type="submit" style="font-family:굴림; font-size:9pt; background-color:white; border-width:1px; border-color:black; border-style:dashed; height:20px; width=50;" value="OK">
<★input name="reset" type="reset" style="font-family:굴림; font-size:9pt; background-color:white; border-width:1px; border-color:black; border-style:dashed; height:20px; width=50;" value="Cancel"><★/p>
<★/td>
<★/tr>
<★/table>
<★/form>
<★/BODY>
<★/HTML>
===================================================================
2. 발송하는 php코딩
===================================================================
<?
$tomail = "받는 사람 주소"; //이 폼메일을 받을 메일주소
function error($text){
echo "
<script language=javascript>
window.alert('$text')
history.go(-1)
</script>";
exit;
}
function msg($text){
echo "
<script language=javascript>
window.alert('$text')
top.location.href = 'http://itag.mireene.com/index.php'
</script>
";
exit;
}
if (!$name) {error('성명을 적어주세요');} // 이름이 없을때 에러 메세지
if (!$email) {error('메일 주소를 적어주세요');} // 메일주소가 없을때 에러 메세지
if (!$subject) {error('제목을 적어주세요');} // 제목이 없을때 에러 메세지
$mailheaders = "Return-Path: $email rn"; // 메일 헤더의 반송 메일 주소
$mailheaders .= "From: $name <$email>rn"; // 메일헤더의 이름과 메일 주소 표시
$body = " 이름 : $name rn";
$body .= " E-mail : $email rn";
$body = " 회사 : $company rn";
$body .= " TEL : $tel rn";
$body .= " FAX : $fax rn";
$body .= " 주소 : $ad rn";
$body .= " 품명 : $goods rn";
$body .= " 문의내용 : $content rn";
$result=mail($tomail , $subject , $body , $mailheaders); // 메일 전송
if($result) {msg('메일이 성공적으로 발송되었습니다.');} // 전송 성공시
else{error('메일 발송에 실패하였습니다.');} // 전송 실패시
?>
===================================================================
일단 메일은 즉각즉각 잘 가는데요.....파일첨부버튼 추가 해서 첨부를 좀 하고 싶어요~~~어떻게 해야되나요???