ASP: Sending a HTML form to an email address

Reply

Join Date: Dec 2004
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training

ASP: Sending a HTML form to an email address

 
0
  #1
Feb 9th, 2007
Hi,

I am using CDONTs for sending email using ASP. I need to send a HTML form that takes values from a MS SQL Server database. How do I send this big code of form using ASP?

I am using the following code to send the email


  1. <%
  2. Set myMail=CreateObject("CDO.Message")
  3. myMail.Subject="Sending email with CDO"
  4. myMail.From="mymail@mydomain.com"
  5. myMail.To="someone@somedomain.com"
  6. myMail.HTMLBody = "--FORM CODE HERE--"
  7. myMail.Send
  8. set myMail=nothing
  9. %>



The code for the form is as below

  1. <form method="post" target="_blank" action="http://tulleeho.com/tastemaker/members-feedback.asp">
  2. <table width="70%" border="0" align="center" cellpadding="3" cellspacing="4" style="border:1px dotted #CCCCCC;">
  3. <tr>
  4. <td class="style1"><div align="right"><span class="style1">Name:</span></div></td>
  5. <td><input type="text" name="txtuserFirstName" value="<% =rs("userFirstName") %>"></td>
  6. </tr>
  7. <tr class="style1">
  8. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  9. </tr>
  10. <tr>
  11. <td class="style1"><div align="right">Age:</div></td>
  12. <td><input type="text" name="txtUserAge" value="<%= datediff("yyyy",year(date),rs("userdateofBirth")) %>"></td>
  13. </tr>
  14. <tr class="style1">
  15. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  16. </tr>
  17. <tr>
  18. <td class="style1"><div align="right">Sex:</div></td>
  19. <td><select name="txtuserSex">
  20. <option value="<% if rs("usersex") = "True" then response.Write "1"
  21. if rs("usersex") = "False" then response.Write "0"%>"><% if rs("usersex") = "True" then response.Write "Male"
  22. if rs("usersex") = "False" then response.Write "Female"%></option>
  23. <option value="<% if rs("usersex") = "True" then response.Write "0"
  24. if rs("usersex") = "False" then response.Write "1"%>"><% if rs("usersex") = "True" then response.Write "Female"
  25. if rs("usersex") = "False" then response.Write "Male"%></option>
  26. </select> </td>
  27. </tr>
  28. <tr class="style1">
  29. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  30. </tr>
  31. <tr>
  32. <td class="style1"><div align="right">City:</div></td>
  33. <td><select name="txtUserCity">
  34. <option <% if rs("userCity") = "Bangalore" then response.Write "selected" %>>Bangalore</option>
  35. <option <% if rs("userCity") = "New Delhi" then response.Write "selected" %>>New Delhi</option>
  36. <option <% if rs("userCity") = "Mumbai" then response.Write "selected" %>>Mumbai</option>
  37. <option <% if rs("userCity") = "Hyderabad" then response.Write "selected" %>>Hyderabad</option>
  38. <option <% if rs("userCity") = "Pune" then response.Write "selected" %>>Pune</option>
  39. <option <% if rs("userCity") = "Jaipur" then response.Write "selected" %>>Jaipur</option>
  40. </select> </td>
  41. </tr>
  42. <tr class="style1">
  43. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  44. </tr>
  45. <tr>
  46. <td class="style1"><div align="right">Mobile No.: </div></td>
  47. <td><input type="text" name="txtuserPhoneNumberM" value="<% =rs("userPhoneNumberM") %>"></td>
  48. </tr>
  49. <tr class="style1">
  50. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  51. </tr>
  52. <tr>
  53. <td class="style1"><div align="right">Occupation:</div></td>
  54. <td><input type="text" name="txtuserOccupation"></td>
  55. </tr>
  56. <tr class="style1">
  57. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  58. </tr>
  59. <tr>
  60. <td valign="top" class="style1"><div align="right">Favourite Beverages:</div></td>
  61. <td valign="top" class="style1">
  62. Vodka:
  63. <input type="checkbox" name="chkfav_bev" value="Vodka">
  64. Baileys: <input type="checkbox" name="chkfav_bev" value="Baileys">
  65.  
  66. Liqueur:
  67. <input type="checkbox" name="chkfav_bev" value="Liqueur">
  68. <br>
  69. Tequila: <input type="checkbox" name="chkfav_bev" value="Tequila">
  70.  
  71. Whisky:
  72. <input type="checkbox" name="chkfav_bev" value="Whisky">
  73. Peach Schnapps: <input type="checkbox" name="chkfav_bev" value="Peach Schnapps">
  74. <br>
  75. Beer:
  76. <input type="checkbox" name="chkfav_bev" value="Beer">
  77. Dark Rum: <input type="checkbox" name="chkfav_bev" value="Dark Rum">
  78.  
  79. White Rum:
  80. <input type="checkbox" name="chkfav_bev" value="White Rum">
  81. Wine: <input type="checkbox" name="chkfav_bev" value="Wine">
  82. Gin: <input type="checkbox" name="chkfav_bev" value="Gin"> </td>
  83. </tr>
  84. <tr class="style1">
  85. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  86. </tr>
  87. <tr>
  88. <td valign="top" class="style1"><div align="right">****tails you drink:</div></td>
  89. <td><input type="text" name="txtuser****tails">
  90. <br>
  91. <input type="text" name="txtuser****tails">
  92. <br>
  93. <input type="text" name="txtuser****tails">
  94. <br>
  95. <input type="text" name="txtuser****tails"></td>
  96. </tr>
  97. <tr class="style1">
  98. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  99. </tr>
  100. <tr>
  101. <td valign="top" class="style1"><div align="right">Brands you purchase:</div></td>
  102. <td><p>
  103. <input type="text" name="txtuserBrands">
  104. <br>
  105. <input type="text" name="txtuserBrands">
  106. <br>
  107. <input type="text" name="txtuserBrands">
  108. <br>
  109. <input type="text" name="txtuserBrands">
  110. </p>
  111. <p>&nbsp; </p></td>
  112. </tr>
  113. <tr class="style1">
  114. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  115. </tr>
  116. <tr>
  117. <td class="style1"><div align="right">Favourite bar:</div></td>
  118. <td><input type="text" name="txtuserFavBar"></td>
  119. </tr>
  120. <tr class="style1">
  121. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  122. </tr>
  123. <tr>
  124. <td class="style1"><div align="right">Monthly spend on alcoholic beverages:</div></td>
  125. <td><select name="txtuserMonthlySpend">
  126. <option>0-500</option>
  127. <option>501-1000</option>
  128. <option>1001-1500</option>
  129. <option>More then 1500</option>
  130. </select> </td>
  131. </tr>
  132. <tr class="style1">
  133. <td colspan="2"><HR align="right" style="border:1px dotted #CCCCCC;"></td>
  134. </tr>
  135. <tr>
  136. <td class="style1"><div align="right"></div></td>
  137. <td><input name="subfeedback" type="submit" id="subfeedback" value="Submit"></td>
  138. </tr>
  139. </table>
  140. <input name="txtuserid" type="hidden" value="<%=rs("userid") %>">
  141. </form>
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 66
Reputation: Baradaran is an unknown quantity at this point 
Solved Threads: 4
Baradaran Baradaran is offline Offline
Junior Poster in Training

Re: ASP: Sending a HTML form to an email address

 
0
  #2
Feb 16th, 2007
To display all values, simply use this code:

For each i in Request.Form
myMail.HTMLBody = myMail.HTMLBody & i & ": " & request.form(i) & "<br>"
next
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