<%@ 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 = "destek@hazirkod.com"
mail.To = request.form("EmailAddress")
mail.Subject = "ASP.NET-VB.NET :Sayfa içinden email gönderimi"
mail.Body =request.form("Mesaj")
mail.BodyFormat = MailFormat.Html
SmtpMail.Send(mail)
End If
End Sub
</script>
<html>
<head>
</head>
<body>
<h2 align="center">ASP.NET de sayfa içinden Email Gönderme : CDONTS nesnesi ..</h1>
<br />
<br />
<asp:Label id="lblMessage" Font-Name="Verdana" Width="400px" BorderStyle="solid" BorderColor="#cccccc" runat="server"/>
<form method="post" name="form1" runat="server" runat="server">
Email Address:<input type="text" name="EmailAddress" size="30" value=""><br><br>
Mesaj:<input type="text" name="Mesaj" size="100" value=""><br><br>
<input type="Submit" id="btnSubmit" OnServerClick="btn_Click" value=" Gonder " name="b1" runat="server" />
</form>
</body>
</html>