iam trying to implement code of sending mail.i have tried the following procedure.
Configuration
<configuration>
<!-- Add the email settings to the <system.net> element -->
<system.net>
<mailSettings>
<smtp>
<network
host="localhost"
port="25"
userName="?"
password="?" />
</smtp>
</mailSettings>
</system.net>
HTML
<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>
Code-behind
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
but its not working. error is The transport failed to connect to the server.