1.649 kez okundu

Asp de form mail nasıl yapılır

10 10 1.649 kez okundu incelendi

Sitenizdeki ziyaretçilerin size kolay bi şekilde ulaşması için bir formmail yapalım.

Bir db ve 6 tane sayfadan oluşacak formmailimiz.

Başlayalım ilk olarak default sayfasını yapalım

Aşağıdaki kodları default.asp olarak kayıt edin…

<% @LANGUAGE=VBscript %>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stil.css">
****** http-equiv="Content-Language" *********"tr">
****** name="GENERATOR" *********"Microsoft FrontPage 5.0">
****** name="ProgId" *********"FrontPage.Editor.Document">
****** http-equiv="Content-Type" *********"text/html; charset=windows-1254">
<title>İletişim Forumu</title>
</head>
<body><center>
<form method="POST" action="datagonder.asp">
<%
Dim  temp, ip
temp = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If  temp<>""  Then
ip = temp
Else
ip = Request.ServerVariables("REMOTE_ADDR")
End  If
%>
<p style="margin-bottom: 10">
&nbsp;</p>
<table border="0" cellpadding="0" cellspacing="0" style="border:1.5pt solid black; " width="39%" id="AutoNumber1" height="474" fpstyle="3,011111100">
<tr>
<td width="46%" height="16" colspan="3" style="border-style: none; font-weight:bold; color:white; background-color:black">
<p align="center" class="yazi"><b><font size="2" color="#FFFFFF">İLETİŞİM</font></b></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">&nbsp;</td>
<td width="16%" class="yazi" height="24" style="border-style: none; "><font face="Tahoma">
<span style="font-size: 9pt">İSİM </span></font> </td>
<td width="24%" height="24" align="left" style="border-style: none; ">
&nbsp;<input class="metinkutusu" type="text" name="isim" size="15">
<font face="Tahoma" color="#FF3300">*</font></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">&nbsp;</td>
<td width="16%" height="25" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
SOY İSİM</font></td>
<td width="24%" height="25" align="left" style="border-style: none; ">
&nbsp;<input class="metinkutusu" type="text" name="soyisim" size="15">
<font face="Tahoma" color="#FF3300">*</font></td>
</tr>
<tr>
<td width="3%" height="26" style="border-style: none; ">
&nbsp;</td>
<td width="16%" height="26" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
CİNSİYET</font></td>
<td width="24%" height="26" align="left" style="border-style: none; ">
&nbsp;<select size="1" name="cinsiyet" class="metinkutusu">
<option selected>Cinsiyetiniz</option>
<option value="Erkek">Bay</option>
<option value="Bayan">Bayan</option>
</select> <font face="Tahoma" color="#FF3300">*</font></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">
&nbsp;</td>
<td width="16%" height="25" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
TEL:</font></td>
<td width="24%" height="25" align="left" style="border-style: none; ">
&nbsp;<font face="Tahoma" style="font-size: 9pt">Alan :</font><input class="metinkutusu" type="text" name="telalan" size="3">-<input class="metinkutusu" type="text" name="tel" size="15">
<font face="Tahoma" color="#FF3300">*</font></td>
</tr>
<tr>
<td width="3%" height="24" style="border-style: none; ">
&nbsp;</td>
<td width="16%" height="24" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">E-MAIL:</font></td>
<td width="24%" height="24" align="left" style="border-style: none; ">
&nbsp;<input class="metinkutusu" type="text" name="email" size="15">
<font face="Tahoma" color="#FF3300">*</font></td>
</tr>
<tr>
<td width="3%" height="26" style="border-style: none; "></td>
<td width="16%" height="26" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">WEB
SİTE</font></td>
<td width="24%" height="26" align="left" style="border-style: none; ">
&nbsp;<input class="metinkutusu" type="text" name="website" size="15"></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">&nbsp;</td>
<td width="16%" height="25" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
KONU:</font></td>
<td width="24%" height="25" align="left" style="border-style: none; ">
&nbsp;<select size="1" name="konu" class="metinkutusu">
<option selected>Seçiniz</option>
<option value="Oneri">Öneri</option>
<option value="Sikayet">Şikayet</option>
<option value="Tavsiye">Tavsiye</option>
</select> <font face="Tahoma" color="#FF3300">*</font></td>
</tr>
<tr>
<td width="3%" height="82" style="border-style: none; ">&nbsp;</td>
<td width="16%" height="82" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
MESAJINIZ:</font></td>
<td width="24%" height="82" align="left" style="border-style: none; "><font class="yazi"><font>
<textarea name="mesaj" id="txtMetin" rows="5" cols="32" class="metinkutusu"></textarea>
</font></font><font face="Tahoma" color="#FF3300">*</font></td>
</tr>
<tr>
<td width="3%" height="19" style="border-style: none; "></td>
<td width="16%" height="19" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
TARİH / SAAT:</font></td>
<td width="24%" height="19" align="left" style="border-style: none; "><font face="Tahoma" size="2"> <% = Date %>
- <% = time %><input class="metinkutusu" type="hidden" name="tarihsaat" size="15" value="<% = Date %> - <% = time %>"></font></td>
</tr>
<tr>
<td width="3%" height="20" style="border-style: none; ">
&nbsp;</td>
<td width="16%" height="20" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">IP
ADRESİNİZ:</font></td>
<td width="24%" height="20" style="border-style: none; ">
<font face="Tahoma"><span style="font-size: 10pt"><% Response.Write ip %><input class="metinkutusu" type="hidden" name="ip" size="15" value="<% Response.Write ip %>"></span></font></td>
</tr>
<tr>
<td width="3%" height="16" style="border-style: none; "></td>
<td width="16%" height="16" style="border-style: none; "></td>
<td width="24%" height="16" align="center" style="border-style: none; "><font class="yazi"><font>
<input type="submit" value="Gönder" class="tus" />
<input type="reset" value="Temizle" class="tus" /></td>
</tr>
<tr>
<td width="46%" height="19" style="border-style: none; " colspan="3">
<font face="Tahoma" style="font-size: 8pt" color="#FF3300">&nbsp;Güvenlik Sebebi ile Ip
Adresi Tarih ve Saat ile birlikte Kayıt Edilmektedir</font></td>
</tr>
</table>
</form>
</body>
</html>

Şimdi vereceğim kodları ise datagönder.asp olarak kayıt edin..

<center>
<html>
<head>
<title>İletişim Formu</title>
<link rel="stylesheet" type="text/css" href="stil.css">
</head>
<body>
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/db.mdb")
isim = Request.Form ("isim")
soyisim = Request.Form ("soyisim")
sehir = Request.Form ("sehir")
yas = Request.Form ("yas")
cinsiyet = Request.Form ("cinsiyet")
telalan = Request.Form ("telalan")
tel = Request.Form ("tel")
cepalan = Request.Form ("cepalan")
cep = Request.Form ("cep")
email = Request.Form ("email")
website = Request.Form ("website")
konu = Request.Form ("konu")
mesaj = Request.Form ("mesaj")
tarihsaat = Request.Form ("tarihsaat")
ip = Request.Form ("ip")
Set Rs = Server.CreateObject ("ADODB.RecordSet")
Sql = "Select * from sancak"
Rs.Open Sql, Connect, 1, 3
'doldurulmamis form kutucuklarini doldurulmasini istiyoruz
if isim ="" or soyisim ="" or cinsiyet ="" or telalan ="" or tel ="" or konu ="" or mesaj ="" then
Response.Write " * Lütfen İşaretli alanları Doldurunuz..."
else
Rs.AddNew
Rs("isim")=isim
Rs("soyisim")=soyisim
Rs("sehir")=sehir
Rs("yas")=yas
Rs("cinsiyet")=cinsiyet
Rs("telalan")=telalan
Rs("tel")=tel
Rs("cepalan")=cepalan
Rs("cep")=cep
Rs("email")=email
Rs("website")=website
Rs("konu")=konu
Rs("mesaj")=mesaj
Rs("tarihsaat")=tarihsaat
Rs("ip")=ip
Rs.Update
Response.Write "<b>Mesajınız iletilmiştir En kısa Sürede incelenecektir."
end if
Rs.close
Set Rs = Nothing
%>
<input onClick="history.back();" type="button" value="Geri Dön"></font></u></font></b><p align="center"><p align="center"><p align="center">
</p>
<html></center>

Bunları da yaptıysanız şimdi yönetim bölümünü yapalım. Aşağıdaki kodlarıda yonetim.asp diye kayıt edin…

<!--#include File="sifre.asp"-->
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/db.mdb")
%>
<meta http-equiv="Content-Language" content="tr">
<%
Set Rs = Server.CreateObject ("ADODB.RecordSet")
Sql = "Select * from sancak"
Rs.Open Sql,Connect,1,3
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="58%">
<tr>
<td width="25%" align="left"><font face="Tahoma" size="2">ADI SOYADI</font></td>
<td width="25%" align="left"><font face="Tahoma" size="2">İLETİŞİM KONUSU</font></td>
<td width="25%" align="center"><font face="Tahoma" size="2">OKU</font></td>
<td width="25%" align="center"><font face="Tahoma" size="2">SİLME İŞLEMİ</font></td>
</tr>
</table>
</center>
</div>
<center>
<%
Do while not Rs.eof
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="58%">
<tr>
<td width="100%" colspan="4">&nbsp;</td>
</tr>
<tr>
<td width="25%" style="border: 1px dotted #C0C0C0"><font size="2" face="Tahoma"><%=Rs("isim")%>&nbsp;<%=Rs("soyisim")%></font></td>
<td width="25%" style="border: 1px dotted #C0C0C0"><font size="2" face="Tahoma"><%=Rs("konu")%></font></td>
<td width="25%" style="border: 1px dotted #C0C0C0">
<p align="center">
<font size="2" face="Tahoma"><a href="oku.asp?id=<%=Rs("id")%>"><img border="0" src="images/oku.gif"></a></font></td>
<td width="25%" style="border: 1px dotted #C0C0C0">
<p align="center"><a href="sil.asp?id=<%=Rs("id")%>">
<font size="2" face="Tahoma"><img border="0" src="images/sil.bmp"></font></a></td>
</tr>
<tr>
<td width="100%" colspan="4">&nbsp;</td>
</tr>
</table>
<%
Rs.MoveNext
Loop
%>
</center>
<p align="center">&nbsp;</p>

Bunuda yaptıysanız yönetime giriş için şifre sayfamızı oluşturalım vereceğim kodları sifre.asp olarak kayıt edin…

<%
dim sifre
sifre = "admin"
if session("administrator") <> sifre then
if request.form("administrator") <> sifre then
call sifreform
else
session("administrator") = sifre
end if
end if
%>
<%
sub sifreform
aynen = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")
%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stil.css">
<title>İletişim Formu</title>
</head>
<body bgcolor="#FFFFFF">
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<p align="center">&nbsp;</p>
<form method=post action="<%=aynen%>">
<p align="center">
<font class="yazi">&nbsp;<span style="font-size: 9pt"><font face="Tahoma">Yönetici Parolası :</font></span></font>
<input type="password" name="administrator" value="" size="20" class="metinkutusu"><font color="#008000">
</font>
&nbsp;<input type="submit" value="Giris Yap" class="tus">
</form>
</font>
<p align="center">&nbsp;</p>
<%
response.end
end sub
%>

Evet, sıra geldi oku ve sil komutlarına. İlk verdiğim kodları oku.asp, ikinci verdiğim kodlarıda sil.asp olarak kayıt edin.

oku.asp

<% @LANGUAGE=VBscript %>
<!--#include File="sifre.asp"-->
<html>
<head>
<link rel="stylesheet" type="text/css" href="stil.css">
<meta http-equiv="Content-Language" content="tr">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">
<title>İletişim Formu</title>
</head>
<body><center>
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/db.mdb")
%>
<%
id= Request("id")
Set Rs = Server.CreateObject ("ADODB.RecordSet")
Sql = "Select * from sancak where id = " &id& ""
Rs.Open Sql,Connect,1,3
%>
<p style="margin-bottom: 10">
&nbsp;</p>
<table border="0" cellpadding="0" cellspacing="0" style="border:1.5pt solid black; " width="39%" id="AutoNumber1" height="474" fpstyle="3,011111100">
<tr>
<td width="46%" height="16" colspan="3" style="border-style: none; font-weight:bold; color:white; background-color:black">
<p align="center" class="yazi"><b>
<font face="Tahoma" size="2" color="#FFFFFF">İLETİŞİM</font></b></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">&nbsp;</td>
<td width="16%" class="yazi" height="24" style="border-style: none; "><font face="Tahoma">
<span style="font-size: 9pt">İSİM </span></font> </td>
<td width="24%" height="24" align="left" style="border-style: none; ">
<font face="Tahoma" style="font-size: 9pt" color="#808080">&nbsp;<%=Rs("isim")%></font></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">&nbsp;</td>
<td width="16%" height="25" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
SOY İSİM</font></td>
<td width="24%" height="25" align="left" style="border-style: none; ">
<font face="Tahoma" style="font-size: 9pt" color="#808080">&nbsp;<%=Rs("soyisim")%></font></td>
</tr>
<tr>
<td width="3%" height="26" style="border-style: none; ">
&nbsp;</td>
<td width="16%" height="26" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
CİNSİYET</font></td>
<td width="24%" height="26" align="left" style="border-style: none; ">
<font face="Tahoma" style="font-size: 9pt" color="#808080">&nbsp;<%=Rs("cinsiyet")%></font></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">
&nbsp;</td>
<td width="16%" height="25" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
TEL:</font></td>
<td width="24%" height="25" align="left" style="border-style: none; ">
<font face="Tahoma" style="font-size: 9pt" color="#808080">&nbsp;<%=Rs("telalan")%>-<%=Rs("tel")%></font></td>
</tr>
<tr>
<td width="3%" height="24" style="border-style: none; ">
&nbsp;</td>
<td width="16%" height="24" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">E-MAIL:</font></td>
<td width="24%" height="24" align="left" style="border-style: none; ">
<font face="Tahoma" style="font-size: 9pt" color="#808080">&nbsp;<%=Rs("email")%></font></td>
</tr>
<tr>
<td width="3%" height="26" style="border-style: none; "></td>
<td width="16%" height="26" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">WEB
SİTE</font></td>
<td width="24%" height="26" align="left" style="border-style: none; ">
<font face="Tahoma" style="font-size: 9pt" color="#808080">&nbsp;<%=Rs("website")%></font></td>
</tr>
<tr>
<td width="3%" height="25" style="border-style: none; ">&nbsp;</td>
<td width="16%" height="25" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
KONU:</font></td>
<td width="24%" height="25" align="left" style="border-style: none; ">
<font face="Tahoma" style="font-size: 9pt" color="#808080">&nbsp;<%=Rs("konu")%></font></td>
</tr>
<tr>
<td width="3%" height="82" style="border-style: none; ">&nbsp;</td>
<td width="40%" height="82" style="border-style: none; " colspan="2" valign="top"><font face="Tahoma" style="font-size: 9pt">
MESAJI :<font color="#808080"> <%=Rs("mesaj")%></font></font></td>
</tr>
<tr>
<td width="43%" height="20" colspan="3" style="border-style: none; ">
<p align="left"><b><font face="Tahoma" size="2">GÜVENLİK BİLGİLERİ</font></b></td>
</tr>
<tr>
<td width="3%" height="19" style="border-style: none; "></td>
<td width="16%" height="19" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">
TARİH / SAAT:</font></td>
<td width="24%" height="19" align="left" style="border-style: none; "><font face="Tahoma" size="2">
<%=Rs("tarihsaat")%></font><font face="Tahoma" style="font-size: 9pt" color="#808080">      </font></td>
</tr>
<tr>
<td width="3%" height="20" style="border-style: none; ">
<img border="0" src="images/ip.gif"></td>
<td width="16%" height="20" style="border-style: none; "><font face="Tahoma" style="font-size: 9pt">IP
ADRESİNİZ:</font></td>
<td width="24%" height="20" style="border-style: none; ">
<font face="Tahoma"><span style="font-size: 10pt"><%=Rs("ip")%></span></font></td>
</tr>
<tr>
<td width="3%" height="16" style="border-style: none; "></td>
<td width="16%" height="16" style="border-style: none; ">
</td>
<td width="24%" height="16" align="center" style="border-style: none; "><font class="yazi">
<font face="Tahoma" style="font-size: 9pt">
&nbsp;</font></font><a href="sil.asp?id=<%=Rs("id")%>"><font face="Tahoma" style="font-size: 9pt"><input onClick="history.back();" type="button" value="Geri Dön" class="tus"></font></a></td>
</tr>
<tr>
<td width="46%" height="19" style="border-style: none; " colspan="3">
<font face="Tahoma" style="font-size: 8pt" color="#FF3300">&nbsp;</font></td>
</tr>
</table>
</body>
</html>

sil.asp

<!--#include File="sifre.asp"-->
<title>İletişim Formu</title>
<% Response.Buffer = True %>
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/db.mdb")
%>
<%
id = Request("id")
Set Rs = Server.CreateObject("ADODB.RecordSet")
Delete = "DELETE from sancak WHERE id="&id&""
Rs.open Delete,Connect,1,3
Response.Redirect Request.serverVariables("HTTP_REFERER")
%>

Şimdi bir kod daha vereceğim, bunu da not defterine yazıp stil.css olarak kayıt edeceksiniz.

<!--
/* Yazi Formatları ---------------------------------------------------------------------*/
.Yazi        { font-family: Arial; color: #000000; font-size: 8pt; text-decoration: none; word-wrap:break-word }
.Yazirenksiz { font-family: Arial; font-size: 8pt; text-decoration: none }
.YaziBuyuk { font-family: Arial; font-size: 11pt; text-decoration: none }
.Kirmizi { font-family: Arial; color: #1061BF; font-size: 8pt; text-decoration: none }
.SeciliYazi  { font-family: Arial; color: #FF3300; font-size: 8pt; font-weight: bold }
.Baslik      { font-family: Arial; color: #1061BF; font-size: 8pt; font-weight: bold }
h1      { font-family: Arial; color: #1061BF; font-size: 8pt; font-weight: bold }
/* Bağlantı Formatları -------------------------------------------------*/
A:Link       { font-family: Arial; color: #000000; text-decoration: none }
A:Active     { font-family: Arial; color: #000000; text-decoration: none }
A:Visited    { font-family: Arial; color: #000000; text-decoration: none }
A:Hover      { font-family: Arial; color: #1061BF; text-decoration: none }
/* Tablo Formatları ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
.Golgeli     { border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 2; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 2; padding: 5 }
/* Form Alanı Formatları ------------------------------------------------------------------------------------------*/
.MetinKutusu { font-family: Arial; font-size: 8pt; border: 1px solid #C0C0C0; padding: 1; background-color: #F9F9F9 }
.Tus         { font-family: Arial; font-size: 8pt }
.AcilirKutu  { font-family: Arial; font-size: 8pt }
-->
#clsCode {
font: "Courier New";
font-size: 12;
color: gray;
text-decoration: none;
background-color: #D3D3D3;
border: 1px solid gray;
width: 90%;
}
#mostSelect {
width: 150px;
font: 11px "Trebuchet MS";
}
#fontStyle {
font: 11px "Trebuchet MS";
cursor: pointer;
}
#hostingP
{
color: #1061BF;
height: 1px;
}
#ucretliHosting
{
background-image: url('http://download.aspindir.com/images/title.gif');
border: 1px solid;
border-color: #003CAD;
}
#uHText {
font-family: Arial;
font-size: 8pt;
color:white;
font-weight: bold;
}
#hostingMasterTable
{
border: 1px solid;
border-color: #111111;
font-family: Arial;
font-size: 8pt;
font-weight: bold;
padding: 3px;
}
#hmTText {
font-family: Arial;
font-size: 8pt;
color: #689EDD;
}
#slaveHosting {
font-family: Arial;
font-size: 8pt;
}
#hrP {
color: #EBE5E5;
height: 1px;
}

Bunu da bitirdiyseniz son olarak db’yi vereceğim. Burayı dikkatli okuyun lütfen.

Vereceğim db’yi db adında bir klasör oluşturup içine atınız.

Db’yi indirmek için buraya tıklayınız.

Bu linkten indirerek hostunuza upload edin.

Form maili eklemek istediğiniz sayfaya:

<!--#include File="buraya formmaili upload ettiğin dosyanın adını yaz/default.asp"-->
Paylaş !

Yoruma kapali.

Önceki yazıyı okuyun:
Asp de recursive ile sınırsız kategori listeleme nasıl yapılır

Asp de recursive ile sınırsız kategori listeleme nasıl yapılır

Kapat
Barış Ozcan Facebook Sayfasi
Barış Ozcan Twitter