ASP Form problem - email not coming through

Please support our ASP advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Nov 2007
Posts: 1
Reputation: tinggg is an unknown quantity at this point 
Solved Threads: 0
tinggg tinggg is offline Offline
Newbie Poster

ASP Form problem - email not coming through

 
0
  #1
Nov 27th, 2007
Hi this is my first asp form so please be gentle with me I've setup this form and when I test it and 'send' the email isn't coming through. Can anyone spot a problem in the code?

Thanks for your help

FORM Code

  1. <div class="feedback">
  2. <form action="sendorder.asp" method="post" name="frmInput">
  3. <table>
  4. <tr>
  5. <td bgcolor="#E0E0E0"><b>Download now?</b></td>
  6. <td bgcolor="#E0E0E0"><b>Publication title </b></td>
  7. <td colspan="2" bgcolor="#E0E0E0"><b>How many copies? </b></td>
  8. </tr>
  9. <tr>
  10. <td><a href="/services/PayAndEmploymentEquity/resources/action-plan-booklet.pdf">Yes</a></td>
  11. <td><label for="actionplan">The Pay and Employment Equity Plan of Action</label></td>
  12. <td colspan="2"><input type="text" id="actionplan" name="actionplan" size="3"/></td>
  13. </tr>
  14. <tr>
  15. <td colspan="4" bgcolor="#E0E0E0"><b>Fact Sheets </b></td>
  16. </tr>
  17. <tr>
  18. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-1-what-is-pee-ed3.pdf">Yes</a></td>
  19. <td><label for="whatpeeu">What is Pay and Employment Equity?</label></td>
  20. <td colspan="2"><input type="text" id="whatpeeu" name="whatpeeu" size="3"/></td>
  21. </tr>
  22. <tr>
  23. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-2-pee-plan-of-action-ed3.pdf">Yes</a></td>
  24. <td><label for="peeuaction">Pay and Employment Equity Plan of Action</label></td>
  25. <td colspan="2"><input type="text" id="peeuaction" name="peeuaction" size="3"/></td>
  26. </tr>
  27. <tr>
  28. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-3-joint-working-ed3.pdf">Yes</a></td>
  29. <td><label for="review">Working in a Joint Employer/Union Review Committee on Pay and Employment Equity</label></td>
  30. <td colspan="2"><input type="text" id="review" name="review" size="3"/></td>
  31. </tr>
  32. <tr>
  33. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-4-history-of-pee-in-nz-ed2.pdf">Yes</a></td>
  34. <td><label for="history">The History of Pay and Employment Equity in New Zealand</label> </td><td colspan="2"><input type="text" id="history" name="history" size="3"/></td>
  35. </tr>
  36. <tr>
  37. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-5-definitions-ed3.pdf">Yes</a></td>
  38. <td><label for="definition">Definitions of Pay and Employment Equity Terms</label></td>
  39. <td colspan="2"><input type="text" id="definition" name="definition" size="3"/></td>
  40. </tr>
  41. <tr>
  42. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-6-pee-contestable-fund-ed3.pdf">Yes</a></td>
  43. <td><label for="fund ">Pay and Employment Equity Contestable Fund</label></td>
  44. <td colspan="2"><input type="text" id="fund" name="fund" size="3"/></td>
  45. </tr>
  46. <tr>
  47. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-7-pdf-faq.pdf">Yes</a></td>
  48. <td><label for="faqs">Frequently Asked Questions</label></td>
  49. <td colspan="2"><input type="text" id="faqs" name="faqs" size="3"/></td>
  50. </tr>
  51. <tr>
  52. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-8-pay-investigations.pdf">Yes</a></td>
  53. <td><label for="payinvestigations">Pay Investigations</label></td>
  54. <td colspan="2"><input type="text" id="payinvestigations" name="payinvestigations" size="3"/></td>
  55. </tr>
  56. <tr>
  57. <td><a href="/services/PayAndEmploymentEquity/resources/fact-sheets/factsheet-9-equitable-job-evaluation.pdf">Yes</a></td>
  58. <td><label for="jobevaluation">Equitable Job Evaluation</label></td>
  59. <td colspan="2"><input type="text" id="jobevaluation" name="jobevaluation" size="3"/></td>
  60. </tr>
  61. <tr>
  62. <td><a href="/services/PayAndEmploymentEquity/news/reports/peeu-annual-report-05-06.pdf">Yes</a></td>
  63. <td><label for="annualreport">Steering Group Annual Report 05/06 </label></td>
  64. <td colspan="2"><input type="text" id="annualreport" name="annualreport" size="3"/></td>
  65. </tr>
  66. <tr>
  67. <td colspan="4" bgcolor="#E0E0E0"><b>Case Studies</b><br/>The case studies provide review committees with a further practical resource, alongside the review workbook and the training programmes, of key learnings from organisations that have already conducted reviews. Summary and full case study versions are available.</td>
  68. </tr>
  69. <tr>
  70. <td colspan="2">&nbsp;</td>
  71. <td width="37">Sum.</td>
  72. <td width="41">Full</td>
  73. </tr>
  74. <tr>
  75. <td><a href="/services/PayAndEmploymentEquity/resources/case-studies/dol-full.pdf">Yes</a></td>
  76. <td><label for="sumdol">MyCompany</label></td>
  77. <td><input type="text" id="sumdol" name="sumdol" size="3"/></td>
  78. <td><input type="text" id="fulldol" name="fulldol" size="3"/></td>
  79. </tr>
  80. <tr>
  81. <td><a href="/services/PayAndEmploymentEquity/resources/case-studies/ero-full.pdf">Yes</a></td>
  82. <td><label for="sumero">Education Review Office</label></td>
  83. <td><input type="text" id="sumero" name="sumero" size="3"/></td>
  84. <td><input type="text" id="fullero" name="fullero" size="3"/></td>
  85. </tr>
  86. <tr>
  87. <td><a href="/services/PayAndEmploymentEquity/resources/case-studies/ssc-full.pdf">Yes</a></td>
  88. <td><label for="sumscc">Blue Station</label></td>
  89. <td><input type="text" id="sumscc" name="sumscc" size="3"/></td>
  90. <td><input type="text" id="fullscc" name="fullscc" size="3"/></td>
  91. </tr>
  92. <tr>
  93. <td colspan="4" bgcolor="#E0E0E0"><b>Assessment Tools</b></td>
  94. </tr>
  95. <tr>
  96. <td width="102"><a href="/services/PayAndEmploymentEquity/resources/assessment-tools/workbook.asp">Yes</a></td>
  97. <td width="338"><label for="workbook">Workbook</label></td>
  98. <td colspan="2"><input type="text" id="workbook" name="workbook" size="3"/></td>
  99. </tr>
  100. <tr>
  101. <td><a href="/services/PayAndEmploymentEquity/resources/eje-guidelines.asp">Yes</a></td>
  102. <td><label for="jetool">Equitable Job Evaluation Information</label></td>
  103. <td colspan="2"><input type="text" id="jetool" name="jetool" size="3"/></td>
  104. </tr>
  105. </table>
  106. <table width="400">
  107. <tr>
  108. <th colspan="2" align="left" valign="top" bgcolor="#E0E0E0">Your Details</th>
  109. </tr>
  110. <tr>
  111. <th width="150" align="left" valign="top"><label for="name">Name:</label></th>
  112. <td><input type="text" size="40" id="name" name="name"/></td>
  113. </tr>
  114. <tr>
  115. <th width="150" align="left" valign="top"><label for="organisation">Organisation:</label></th>
  116. <td><input type="text" size="40" id="organisation" name="organisation"/></td>
  117. </tr>
  118. <tr>
  119. <th width="150" align="left" valign="top"><label for="postaladdress">Postal Address:</label></th>
  120. <td><textarea rows="5" id="postaladdress" name="postaladdress" cols="30"></textarea></td>
  121. </tr>
  122. <tr>
  123. <th width="150" align="left" valign="top"><label for="email">Email:</label></th>
  124. <td><input type="text" size="40" id="email" name="email"/></td>
  125. </tr>
  126. <tr>
  127. <td colspan="2" align="left" valign="top"><br/><input name="submit" type="submit" value="s e n d o r d e r"/>
  128. &nbsp;</td>
  129. </tr>
  130. </table>
  131. </form>
  132. <p>
  133. <br/>
  134. </p>
  135. </div>

POST CODE

  1. <%
  2.  
  3. ' declare variables
  4. Dim EmailFrom
  5. Dim EmailTo
  6. Dim Subject
  7. Dim Name
  8. Dim Organisation
  9. Dim PostalAddress
  10. Dim Email
  11. Dim Workbook
  12. Dim actionplan
  13. Dim whatpeeu
  14. Dim peeuaction
  15. Dim review
  16. Dim history
  17. Dim definition
  18. Dim fund
  19. Dim faqs
  20. Dim payinvestigations
  21. Dim jobevaluation
  22. Dim annualreport
  23. Dim sumdol
  24. Dim fulldol
  25. Dim sumero
  26. Dim fullero
  27. Dim sumscc
  28. Dim fullscc
  29. Dim jetool
  30.  
  31. ' get posted data into variables
  32. EmailFrom = Trim(Request.Form("EmailFrom"))
  33. EmailTo = "myemail@myemail.com"
  34. Subject = Trim(Request.Form("Subject"))
  35. Name = Trim(Request.Form("Name"))
  36. Email = Trim(Request.Form("Email"))
  37. Organisation = Trim(Request.Form("Organisation"))
  38. PostalAddress = Trim(Request.Form("PostalAddress"))
  39. Workbook = Trim(Request.Form("Workbook"))
  40. actionplan = Trim(Request.Form("actionplan"))
  41. whatpeeu = Trim(Request.Form("whatpeeu"))
  42. peeuaction = Trim(Request.Form("peeuaction"))
  43. review = Trim(Request.Form("review"))
  44. history = Trim(Request.Form("history"))
  45. definition = Trim(Request.Form("definition"))
  46. fund = Trim(Request.Form("fund"))
  47. faqs = Trim(Request.Form("faqs"))
  48. payinvestigations = Trim(Request.Form("payinvestigations"))
  49. jobevaluation = Trim(Request.Form("jobevaluation"))
  50. annualreport = Trim(Request.Form("annualreport"))
  51. sumdol = Trim(Request.Form("sumdol"))
  52. fullero = Trim(Request.Form("fullero"))
  53. sumero = Trim(Request.Form("sumero"))
  54. fullero = Trim(Request.Form("fullero"))
  55. sumscc = Trim(Request.Form("sumscc"))
  56. fullscc = Trim(Request.Form("fullscc"))
  57. jetool = Trim(Request.Form("jetool"))
  58.  
  59.  
  60. ' prepare email body text
  61. Dim Body
  62. Body = Body & "Name: " & Name & VbCrLf
  63. Body = Body & "Organisation: " & Organisation & VbCrLf
  64. Body = Body & "Postal Address: " & PostalAddress & VbCrLf
  65. Body = Body & "Email: " & Email & VbCrLf
  66. Body = Body & "Workbook: " & Workbook & VbCrLf
  67. Body = Body & "The Pay and Employment Equity Plan of Action: " & actionplan & VbCrLf
  68. Body = Body & "What is Pay and Employment Equity?: " & whatpeeu & VbCrLf
  69. Body = Body & "Working in a Joint Employer/Union Review Committee on Pay and Employment Equity: " & review & VbCrLf
  70. Body = Body & "The History of Pay and Employment Equity: " & history & VbCrLf
  71. Body = Body & "Definitions of Pay and Employment Equity Terms: " & definition & VbCrLf
  72. Body = Body & "Pay and Employment Equity Contestable Fund: " & fund & VbCrLf
  73. Body = Body & "Frequently Asked Questions: " & faqs & VbCrLf
  74. Body = Body & "Pay Investigations: " & payinvestigations & VbCrLf
  75. Body = Body & "Equitable Job Evaluation: " & jobevaluation & VbCrLf
  76. Body = Body & "Steering Group Annual Report: " & annualreport & VbCrLf
  77. Body = Body & "Case Study: MyCompany, Summary: " & sumdol & VbCrLf
  78. Body = Body & "Case Study: MyCompany, Full: " & fulldol & VbCrLf
  79. Body = Body & "Case Study: Education Review Office, Summary: " & sumero & VbCrLf
  80. Body = Body & "Case Study: Education Review Office, Full: " & fullero & VbCrLf
  81. Body = Body & "Case Study: Blue Station, Summary: " & sumscc & VbCrLf
  82. Body = Body & "Case Study: Blue Station, Full: " & fullscc & VbCrLf
  83. Body = Body & "Assessment Details: Equitable Job Evaluation Information: " & jetool & VbCrLf
  84.  
  85.  
  86. Set Email = Server.CreateObject("CDO.Message")
  87. Set EMailConfig = Server.CreateObject("CDO.Configuration") 'calls CDO configuration COM object
  88. 'Set Flds = EmailConfig.Fields
  89.  
  90. With EmailConfig.Fields
  91. .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 'tells cdo we are using the local smtp service
  92. .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup" 'verify that this path is correct
  93. .Update 'updates CDOs configuration
  94. End With
  95.  
  96. With Email
  97. .Configuration = EMailConfig
  98. .From = "Stuff Website"
  99. .Subject = "Publications Order"
  100. .TextBody = body
  101. .To = "myemail@myemail.com"
  102. .Send
  103. End With
  104.  
  105. Set EMailConfig = nothing
  106. Set Email = Nothing
  107.  
  108. Response.Redirect "orderdone.asp"
  109. %>
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 48
Reputation: CertGuard is an unknown quantity at this point 
Solved Threads: 3
CertGuard's Avatar
CertGuard CertGuard is offline Offline
Light Poster

Re: ASP Form problem - email not coming through

 
0
  #2
Nov 28th, 2007
The only thing I can see which looks like it would cause a problem is:

  1. .From = "Stuff Website"

.From should contain an email address.

Are you receiving any errors?
--
Robert Williams
CEO, Founder
CertGuard
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP Form problem - email not coming through

 
0
  #3
Nov 28th, 2007
Also what might just make it look cleaner and shorter code, you can set your variables when you delcare them. This might help you in the future for debugging as everything you need is right there:

Dim strName = Trim(Request.Form("name"))
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP Form problem - email not coming through

 
0
  #4
Nov 28th, 2007
Also, with asp, you should stick with declaring the variables with what they are:

int for integer, str for string

Dim strName = Trim(Request.Form("name"))

This lets the server know that what you are playing with is a string or integer. Just faster and less prone to accidents.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 48
Reputation: CertGuard is an unknown quantity at this point 
Solved Threads: 3
CertGuard's Avatar
CertGuard CertGuard is offline Offline
Light Poster

Re: ASP Form problem - email not coming through

 
0
  #5
Nov 28th, 2007
Originally Posted by SheSaidImaPregy View Post
Also what might just make it look cleaner and shorter code, you can set your variables when you delcare them. This might help you in the future for debugging as everything you need is right there:

Dim strName = Trim(Request.Form("name"))
I don't think that's valid in Classic ASP, but you could just as easily do this:

Dim strName:strName = Trim(Request.Form("name"))
--
Robert Williams
CEO, Founder
CertGuard
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP Form problem - email not coming through

 
0
  #6
Nov 28th, 2007
always worked for me. In asp.net you have to declare it before setting it:

dim strHelp As String = whatever

However, that might depend on asp version. I have never really checked.
Last edited by SheSaidImaPregy; Nov 28th, 2007 at 9:45 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 48
Reputation: CertGuard is an unknown quantity at this point 
Solved Threads: 3
CertGuard's Avatar
CertGuard CertGuard is offline Offline
Light Poster

Re: ASP Form problem - email not coming through

 
0
  #7
Nov 28th, 2007
This is ASP 3.0 and you can see the error it gives me:

http://www.certguard.com/splitColumn2.asp

but yeah, in ASP.NET that solution works fine. (Same with VB6 IIRC)
--
Robert Williams
CEO, Founder
CertGuard
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP Form problem - email not coming through

 
0
  #8
Nov 29th, 2007
odd, but okay. I believe I only worked in asp 2.0, but anyway.. my current sites still function correctly with that syntax. Regardless, thanks for the knowledge.
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the ASP Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC