Üye Kayıt Üye Giriş

Asp.Net ile Mail Yollama


Asp.Net ile Mail Yollama

 
<%@ Page Language="VB" EnableSessionState="False" EnableViewState="False" Trace="False" Debug="False" Strict="True" %>
<%@ Import Namespace="System.Web.Mail" %>
<script language="VB" runat=server>

Sub Page_load(Sender as Object, E as EventArgs)
If request.form("EmailAddress") = "" Then
dim strResponse as string = "Email adresi girin : "
lblMessage.Text = strResponse
Else
dim strResponse as string = "Mesaj HTML format ile bu adrese gonderildi :<br><h2>" & request("EmailAddress") & "</h2>"
lblMessage.Text = strResponse
End If
End Sub

Sub btn_Click(sender as Object, e as System.EventArgs)
If request.form("EmailAddress") <> ""

Dim mail As New MailMessage
mail.From = "mail@gonderen.com"
mail.To = request.form("EmailAddress")
mail.Subject = "Örnek Mail Form"
mail.Body =request.form("Mesaj")
mail.BodyFormat = MailFormat.Html
SmtpMail.Send(mail)
End If
End Sub
</script>

<html>
<body>
CDONTS ile ASP.NET sayfasından mail yollama
<asp:Label id="lblMessage" Font-Name="Verdana" Width="400px" runat="server"/>
<form method="post" name="form1" runat="server" runat="server">
Email: <input type="text" name="EmailAddress" size="30" value=""><br />
Mesaj: <input type="text" name="Mesaj" size="100" value=""><br />
<input type="Submit" id="btnSubmit" OnServerClick="btn_Click" value=" Gonder " name="b1" runat="server" />
</form>
</body>
</html>

Bilgisayar Dershanesi Ders Sahibi;
Bilgisayar Dershanesi

Yorumlar

Yorum Yapabilmek İçin Üye Girişi Yapmanız Gerekmektedir.

ETİKETLER