I cant seem to find anything wrong with this code. However, I get an error message from my catch block everytime.
Imports System
Imports System.net.mail
Imports system.web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.IO
Partial Class contact2
Inherits System.Web.UI.Page
Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.Click
Const ToAddress As String = "ricksvoid@yahoo.com"
'(1) Create the MailMessage instance
Dim mm As New MailMessage(ToAddress, email.Text)
mm.Subject = name.Text
mm.Body = comment.Text
mm.IsBodyHtml = False
Dim smtp As New SmtpClient
smtp.Host = "smtp.rickpace79.com"
Try
smtp.Send(mm)
display2.Text = "message sent"
Catch ex As Exception
display2.Text = "An error has accured! </br></br>"
End Try
End Sub
End Class
Here is the HTML:
<form id="daForm" runat="Server" action="contact2.aspx">
<span class="formText">Please state your name or company.</span><br />
<asp:TextBox ID="name" runat="server" Width="280"></asp:TextBox>
<br /><br />
<span class="formText">*Enter a contact Email address.</span><br />
<asp:TextBox ID="email" runat="server" Width="280"></asp:TextBox>
<br />
<br />
<span class="formText">Post a comment or scheduale an interview.</span><br />
<asp:TextBox ID="comment" runat="server" Width="280" Height="100"></asp:TextBox>
<br /><br />
<asp:Button ID="submit" runat="server" Text="Button" />
<asp:Button ID="clear" runat="server" Text="Button" />
</form>
Could there be a problem with the form tag? Maybe im missing a peice of information in the action attribute?
Please help,
Rick Pace