asp.net helpdesk form

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2006
Posts: 26
Reputation: ForestTech is an unknown quantity at this point 
Solved Threads: 0
ForestTech ForestTech is offline Offline
Light Poster

asp.net helpdesk form

 
0
  #1
Sep 2nd, 2007
Hi All,

I'm creating a helpdesk style feedback form that saves to an xml file so that we can track past requests. The XML part works fine, but the problem I'm having is getting the form to email off details to alert us when a new request is made. The form appears to be working (in that I'm not getting any error message, but the emails aren't coming through.

The form code is:

  1. <table cellpadding="3" cellspacing="3" align="center">
  2. <tr>
  3. <td bgcolor="#F0F0F0" colspan="2" align="center">
  4. <font face="Arial, Helvetica, sans-serif" size="2"><b>Please Fill Out The Form Below</b></font>
  5. </td>
  6. </tr>
  7. <tr>
  8. <td>
  9. <font face="Arial, Helvetica, sans-serif" size="2">Name:*</font>
  10. </td>
  11. <td>
  12. <ASP:Textbox id="name" size="64" runat="server"/>
  13. </td>
  14. <td>
  15. <asp:RequiredFieldValidator id="nameRequired" runat="server" ControlToValidate="name"
  16. ErrorMessage="You must enter a value into Name" Display="dynamic">Enter name
  17. </asp:RequiredFieldValidator>
  18. </td>
  19. </tr>
  20. <tr>
  21. <td>
  22. <font face="Arial, Helvetica, sans-serif" size="2">Company:*</font>
  23. </td>
  24. <td>
  25. <ASP:Textbox id="company" size="64" runat="server" />
  26. </td>
  27. <td>
  28. <asp:RequiredFieldValidator id="companyRequired" runat="server" ControlToValidate="company"
  29. ErrorMessage="You must enter a value into Company" Display="dynamic">Enter company
  30. </asp:RequiredFieldValidator>
  31. </td>
  32. </tr>
  33. <tr>
  34. <td>
  35. <font face="Arial, Helvetica, sans-serif" size="2">Phone(B/H):</font>
  36. </td>
  37. <td>
  38. <ASP:Textbox id="busphone" size="64" runat="server" />
  39. </td>
  40. </tr>
  41. <tr>
  42. <td>
  43. <font face="Arial, Helvetica, sans-serif" size="2">Phone(A/H):</font>
  44. </td>
  45. <td>
  46. <ASP:Textbox id="ahphone" size="64" runat="server" />
  47. </td>
  48. </tr>
  49. <tr>
  50. <td>
  51. <font face="Arial, Helvetica, sans-serif" size="2">Mobile:</font>
  52. </td>
  53. <td>
  54. <ASP:Textbox id="mobile" size="64" runat="server" />
  55. </td>
  56. </tr>
  57. <tr>
  58. <td>
  59. <font face="Arial, Helvetica, sans-serif" size="2">Email:</font>
  60. </td>
  61. <td>
  62. <ASP:Textbox id="txtEmail" size="64" runat="server" />
  63. </td>
  64. </tr>
  65.  
  66. <tr>
  67. <td>
  68. <font face="Arial, Helvetica, sans-serif" size="2">Comment:*</font>
  69. </td>
  70. <td>
  71. <ASP:Textbox id="comment" TextMode="Multiline" columns="50" rows="10" wrap="true" runat="server" />
  72. </td>
  73. <td>
  74. <asp:RequiredFieldValidator id="commentRequired" runat="server" ControlToValidate="comment"
  75. ErrorMessage="You must enter a value into textbox1" Display="dynamic">Enter comment
  76. </asp:RequiredFieldValidator>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td colspan="2" bgcolor="#F0F0F0" colspan="2" align="center">
  81. <ASP:Button id="submit" runat="server" Text="Submit" OnClick="Save_Comment"/>
  82. </td>
  83. </tr>
  84. </table>
and the C# code behind code is:

  1. public partial class _Default : System.Web.UI.Page
  2. {
  3. public TextBox comment;
  4. public TextBox txtEmail;
  5.  
  6. protected void Save_Comment(object sender, EventArgs e)
  7. {
  8. try
  9. {
  10.  
  11. MailMessage message = new MailMessage(txtEmail.Text, "helpdesk@mailserver.com", "Helpdesk Request", comment.Text);
  12. SmtpClient txtEmailClient = new SmtpClient("ns1.mailserver.com");
  13. System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("helpdesk@mailserver.com", "password");
  14. txtEmailClient.UseDefaultCredentials = false;
  15. txtEmailClient.Credentials = SMTPUserInfo;
  16. txtEmailClient.Send(message);
  17.  
  18. }
  19. catch (Exception ex)
  20. {
  21. }
  22. }
  23. }
Forgive the lack of naming conventions! I realised AFTER I hacked apart an old html form from my early web days.

NB. It may or may not also be worth noting that the web server and the mail server are the same.

I had a basic test script that worked, yet this one won't, so any ideas would be great!!

Thanks in advance.
Luke
ForestTech
Last edited by ForestTech; Sep 2nd, 2007 at 10:32 pm. Reason: Hosting Note added
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC