944,111 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 1302
  • ASP RSS
Nov 27th, 2007
0

ASP Form problem - email not coming through

Expand Post »
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

ASP Syntax (Toggle Plain Text)
  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

ASP Syntax (Toggle Plain Text)
  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. %>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tinggg is offline Offline
2 posts
since Nov 2007
Nov 28th, 2007
0

Re: ASP Form problem - email not coming through

The only thing I can see which looks like it would cause a problem is:

ASP Syntax (Toggle Plain Text)
  1. .From = "Stuff Website"

.From should contain an email address.

Are you receiving any errors?
Reputation Points: 10
Solved Threads: 3
Light Poster
CertGuard is offline Offline
48 posts
since Jul 2007
Nov 28th, 2007
0

Re: ASP Form problem - email not coming through

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"))
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007
Nov 28th, 2007
0

Re: ASP Form problem - email not coming through

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.
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007
Nov 28th, 2007
0

Re: ASP Form problem - email not coming through

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"))
Reputation Points: 10
Solved Threads: 3
Light Poster
CertGuard is offline Offline
48 posts
since Jul 2007
Nov 28th, 2007
0

Re: ASP Form problem - email not coming through

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.
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007
Nov 28th, 2007
0

Re: ASP Form problem - email not coming through

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)
Reputation Points: 10
Solved Threads: 3
Light Poster
CertGuard is offline Offline
48 posts
since Jul 2007
Nov 29th, 2007
0

Re: ASP Form problem - email not coming through

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.
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: i need your help
Next Thread in ASP Forum Timeline: Microsoft JET Database Engine error '80040e14'





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC