| | |
sending a feedback form to email in asp.net
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 34
Reputation:
Solved Threads: 0
I cant seem to find anything wrong with this code. However, I get an error message from my catch block everytime.
Here is the HTML:
Could there be a problem with the form tag? Maybe im missing a peice of information in the action attribute?
Please help,
Rick Pace
vb.net Syntax (Toggle Plain Text)
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:
ASP.NET Syntax (Toggle Plain Text)
<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
Last edited by peter_budo; Feb 19th, 2009 at 4:15 pm. Reason: Correcting opening tag from [code language="vb.net"] to [code=vb.net]
What is the error message you are getting. The error message and stack trace should be enough.
Jamie Shedley
Developer
Jamie.Shedley@lightspeeditsolutions.co.uk
http://www.lightspeeditsolutions.co.uk
Developer
Jamie.Shedley@lightspeeditsolutions.co.uk
http://www.lightspeeditsolutions.co.uk
•
•
Join Date: May 2008
Posts: 34
Reputation:
Solved Threads: 0
•
•
•
•
What is the error message you are getting. The error message and stack trace should be enough.
the stack trace leads me to line 26 smtp.send.
Im begining to think its my hosting company aplus.net. Ive learned the hard way that its not worth it to save a few dollars on hosting.
It may be a permissions issue. Under the SMTP variable i believe that there is a username and password property. Try setting these values with the username and password for the email account that will be receiving the email. I dont know if this will work for this scenario but i have had a similar problem before and it was down to permissions. If this still doesn't work try impersonating a user within the web.config file.
Jamie Shedley
Developer
Jamie.Shedley@lightspeeditsolutions.co.uk
http://www.lightspeeditsolutions.co.uk
Developer
Jamie.Shedley@lightspeeditsolutions.co.uk
http://www.lightspeeditsolutions.co.uk
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: Using Proxies without leaving a trace
- Next Thread: How to Dynamic Events / Controls in ASP.NEt C#
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol advice ajax alltypeofvideos application asp asp.net bc30451 bottomasp.net box browser button c# c#gridviewcolumn checkbox click commonfunctions confirmationcodegeneration css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dynamically edit expose feedback fileuploader fill flash form formatdecimal forms formview grid gridview gudi homeedition hosting iframe iis javascript jquery listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security select silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos view virtualdirectory vista visualstudio web webapplications webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





