Answer to Question #12980 in ASP | ASP.NET for mohd faruq

Question #12980
hi sir, i am new on asp and i want to implement email option on a page , so may i know that how will be this possible to send that mail on my personal mail id .. may i have some guidance please with coding if you guys don't mind..
thanks in advance
1
Expert's answer
2012-08-10T09:40:35-0400
<table border="0">
<tr>
<td><b>Your
Email:</b></td>
<td><asp:TextBox runat="server"
ID="UsersEmail"
Columns="30"></asp:TextBox></td>
</tr>
<tr>
<td><b>Subject:</b></td>
<td><asp:TextBox
runat="server" ID="Subject"
Columns="30"></asp:TextBox></td>
</tr>
<tr>
<td
colspan="2">
<b>Body:</b><br />
<asp:TextBox
runat="server" ID="Body" TextMode="MultiLine" Columns="55"
Rows="10"></asp:TextBox>
</td>
</tr>
<tr>
<td
colspan="2" align="center">
<asp:Button runat="server" ID="SendEmail"
Text="Send Feedback"
/>
</td>
</tr>
</table>


//Funstion to
send

Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR
EMAIL ADDRESS
Const ToAddress As String = "you@youremail.com"

'(1)
Create the MailMessage instance
Dim mm As New MailMessage(UsersEmail.Text,
ToAddress)

'(2) Assign the MailMessage's properties
mm.Subject =
Subject.Text
mm.Body = Body.Text
mm.IsBodyHtml = False

'(3) Create
the SmtpClient object
Dim smtp As New SmtpClient

'(4) Send the
MailMessage (will use the Web.config settings)
smtp.Send(mm)
End
Sub

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS