472,802 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,802 software developers and data experts.

Problem sending data info with Jmail page.


I have a SelectBoxes.asp page that is working with multiple selection
dropdown boxes to extract data and total the selection prices.
Tom & Bob were kind enough to give me a big help getting this page
working and it's working just fine, no problems with this page.

However I then would like this data e-mailed using jmail (my host insists
on this method) and that is the function of the sendEMail2.asp page.

This is failing and only giving me a HTTP 500 - Internal server error and
I'm at a loss as to what's wrong.

Any help/sugestions with this would be appreciated, code for both pages
below.

================================================== =======================
SelectBoxes.asp
================================================== =======================

<%@ Language=VBScript %>
<% Option Explicit
Response.Expires = -10000
Dim mComponentRS
Set mComponentRS = Server.CreateObject("ADODB.RecordSet")

Sub GetComponentNameAndPrice(aComponentID, byref aConnection, byref
aComponentName, byref aComponentPrice)
Dim mComponentSQL

mComponentSQL = "select " &_
"component_name," &_
"price " &_
"from " &_
"parts_table " &_
"where " &_
"uniqueid = " & aComponentID

mComponentRS.Open mComponentSQL, aConnection

If mComponentRS.EOF Then
aComponentName = ""
aComponentPrice = 0
Else
aComponentName = mComponentRS("component_name")
aComponentPrice = mComponentRS("price")
End If

mComponentRS.Close
End Sub

%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Build PC</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>

<meta name="Microsoft Theme" content="tp-or12 1110">
<meta name="Microsoft Border" content="tlb, default">
</head>

<BODY>
<font color="#000080" size="2"> <span lang="en-gb"><font face="Arial">
<br>
You can now design your own custom built system
online using our component database. <br>
Select the parts you require from the dropdown selections then click <b>
Go</b>
to display your selection here.<b><br>
</b></font>
</span></font><font face="Arial"><Br>

<%
Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" & "Data Source=" &
Server.MapPath("\data\databasedb.mdb")
sConnectionString="dsn=database1"
%>
<%
Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name, Image
FROM Parts_Table ORDER BY Component_Type, Component_Name"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
'FOR Display & DEBUGGING

If Request.Form("Case") <> "" Then
Dim field
Dim mComponentName, mComponentPrice, mComponentTotal
mComponentTotal = 0

Response.Write "<form method=""post""
action=""SendEMail2.asp"">"

Response.Write "<table border='0' cellspacing='1'
cellpadding='1' width='400'>"
Response.Write "<tr><td><b>Component</b></td><td
align='right'><b></b></td></tr>"

Dim mComponentCount
mComponentCount = 0

for each field in Request.Form
mComponentCount = mComponentCount + 1

'Response.Write "<li>" & Request.Form(field) & ": " &
field & "</li>"

GetComponentNameAndPrice Request.Form(field), oCN,
mComponentName, mComponentPrice

Response.Write "<tr>"

Response.Write "<td>" & mComponentName
Response.Write "<input type='hidden' name='Component" &
mComponentCount & "' value='" & mComponentName & "' />"
Response.Write "</td>"

Response.Write "<td align='right'>" & mComponentPrice
Response.Write "<input type='hidden'
name='ComponentPrice" & mComponentCount & "' value='" & mComponentPrice &
"' />"
Response.Write "</td>"

Response.Write "</tr>"

mComponentTotal = mComponentTotal + mComponentPrice
Next

Response.Write "<tr><td align='right'><b>Total:</b></td><td>
" & mComponentTotal
Response.Write "<input type='hidden'
name='ComponentPriceTotal' value='" & mComponentTotal & "' />"
Response.Write "<input type='hidden' name='ComponentCount'
value='" & mComponentCount & "' />"
Response.Write "</td></tr>"

'END Display & DEBUGGING

Response.Write "<tr><td colspan='2'>"
Response.Write "This is not a sale, no payment is requsted at
this time. Please submit your order and a member of our sales team will
contact you."
Response.Write "</td></tr>"

Response.Write "</table>"

Response.Write "<input type=""submit"" value="" Submit to
sales team "" />"
Response.Write "</form>"
End If

%> </font>

<br /><br />

<form method=Post action=SelectBoxes.asp>
</form>
<% call GetSelectBoxes%>
<font face="Arial">

<table border="0" cellspacing="0">
<tr>
<td>
<input type=submit value=Go> <span lang="en-gb"></span>
</form>
</td>
<td>
<form method="post" action="SelectBoxes.asp"><input type="submit"
value=" Reset " /></form></font>
</form>
</td>
</table>

<font face="Arial" size="2">You can make as many changes as you require,
just select
<b>Go</b> again to update</font>

<%
Sub GetSelectBoxes()

if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true
Dim mCurrentSelectedValue

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'Create a line space between each box
Response.Write ("<br>")
'OK, create the new box.

sCurrentBox=oRS.Fields("Component_Type")
mCurrentSelectedValue = Request.Form(sCurrentBox)

Response.Write sCurrentBox & ": <select name=""" & sCurrentBox
& """>" & vbCrLf

end if

'Now add the individual item
Response.Write vbTab & "<option value=""" & oRS.Fields
("UniqueID") & """"

If mCurrentSelectedValue <> "" Then
If mCurrentSelectedValue = CStr(trim(oRS.Fields
("uniqueid"))) Then
Response.Write " selected "
End If
End If

Response.Write ">" & trim(oRS.Fields("Component_Name")) & " :
" & " " & trim(oRS.Fields("Price")) & "</option>" & vbCrLf
oRS.MoveNext

Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf
end if

Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%> </BODY>
</HTML>
================================================== ==================
sendEMail2.asp page
================================================== ==================

<%
Option Explicit
Response.Expires = -10000
%>

<%

Dim mEMailBody

Dim mComponentLoop
Dim mComponentCount

mComponentCount = Request.Form("ComponentCount")

Response.Write "This is the confirmation page.<br /><br />"

mEMailBody = mEMailBody & "<table border='0' cellspacing='1'
cellpadding='1' width='400'>"
mEMailBody = mEMailBody & "<tr><td><b>Component</b></td><td
align='right'><b></b></td></tr>"

For mComponentLoop = 1 to mComponentCount
mEMailBody = mEMailBody & "<tr>"
mEMailBody = mEMailBody & "<td>" & Request.Form("Component" &
mComponentLoop) & "</td>"
mEMailBody = mEMailBody & "<td align='right'>" & Request.Form
("ComponentPrice" & mComponentLoop) & "</td>"
mEMailBody = mEMailBody & "</tr>"
Next

mEMailBody = mEMailBody & "<tr><td align='right'><b>Total:</b></td><td>
" & Request.Form("ComponentPriceTotal") & "</td></tr>"
mEMailBody = mEMailBody & "</table>"

Response.Write mEMailBody
'start email section

Set JMail = Server.CreateObject ("JMail.SMTPMail")
JMail.ServerAddress = "hostserver.net" 'actual server address removed
JMail.Sender = Name
JMail.ReplyTo = Email
JMail.Subject = Subject
JMail.AddRecipient Recipient
JMail.Body = Name & Email & Tel & vbCrLf & BodyText
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Execute

Response.Redirect("formthanks.html")
Else
'do nothing, just display blank form

End IF
ODBCConnection.Close
Set ODBCConnection=Nothing

Response.Write "<form method='post' action='SendEMail.asp'>"
Response.Write "Name:<input type='text' name='Name' value='' /><br />"
Response.Write "EMail Address:<input type='text' name='EMail' value='' />
<br />"
Response.Write "Tel No:<input type='text' name='Tel' value='' /><br />"
Response.Write "<input type=""hidden"" name=""Recipient""
value=""sa***@company.co.uk"" /><br /> 'actual e-mail address removed
Response.Write "<input type=""hidden"" name=""BodyText"" value=""" &
mEMailBody & """ />"
Response.Write "<input type=""submit"" value="" Send EMail "" /><br />"
Response.Write "</form>"
%>
Jul 19 '05 #1
2 3949
grw
IE > tools > options > advanced > DONT show friendly errors will give the
true problem
"Kingdom" <ki*****@removehotmail.com> wrote in message
news:Xn**********************************@194.117. 133.134...

I have a SelectBoxes.asp page that is working with multiple selection
dropdown boxes to extract data and total the selection prices.
Tom & Bob were kind enough to give me a big help getting this page
working and it's working just fine, no problems with this page.

However I then would like this data e-mailed using jmail (my host insists
on this method) and that is the function of the sendEMail2.asp page.

This is failing and only giving me a HTTP 500 - Internal server error and
I'm at a loss as to what's wrong.

Any help/sugestions with this would be appreciated, code for both pages
below.

================================================== =======================
SelectBoxes.asp
================================================== =======================

<%@ Language=VBScript %>
<% Option Explicit
Response.Expires = -10000
Dim mComponentRS
Set mComponentRS = Server.CreateObject("ADODB.RecordSet")

Sub GetComponentNameAndPrice(aComponentID, byref aConnection, byref
aComponentName, byref aComponentPrice)
Dim mComponentSQL

mComponentSQL = "select " &_
"component_name," &_
"price " &_
"from " &_
"parts_table " &_
"where " &_
"uniqueid = " & aComponentID

mComponentRS.Open mComponentSQL, aConnection

If mComponentRS.EOF Then
aComponentName = ""
aComponentPrice = 0
Else
aComponentName = mComponentRS("component_name")
aComponentPrice = mComponentRS("price")
End If

mComponentRS.Close
End Sub

%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Build PC</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>

<meta name="Microsoft Theme" content="tp-or12 1110">
<meta name="Microsoft Border" content="tlb, default">
</head>

<BODY>
<font color="#000080" size="2"> <span lang="en-gb"><font face="Arial">
<br>
You can now design your own custom built system
online using our component database. <br>
Select the parts you require from the dropdown selections then click <b>
Go</b>
to display your selection here.<b><br>
</b></font>
</span></font><font face="Arial"><Br>

<%
Dim sConnectionString
'sConnectionString="Provider=Microsoft.Jet.OLEDB.4 .0;" & "Data Source=" &
Server.MapPath("\data\databasedb.mdb")
sConnectionString="dsn=database1"
%>
<%
Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name, Image
FROM Parts_Table ORDER BY Component_Type, Component_Name"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
'FOR Display & DEBUGGING

If Request.Form("Case") <> "" Then
Dim field
Dim mComponentName, mComponentPrice, mComponentTotal
mComponentTotal = 0

Response.Write "<form method=""post""
action=""SendEMail2.asp"">"

Response.Write "<table border='0' cellspacing='1'
cellpadding='1' width='400'>"
Response.Write "<tr><td><b>Component</b></td><td
align='right'><b></b></td></tr>"

Dim mComponentCount
mComponentCount = 0

for each field in Request.Form
mComponentCount = mComponentCount + 1

'Response.Write "<li>" & Request.Form(field) & ": " &
field & "</li>"

GetComponentNameAndPrice Request.Form(field), oCN,
mComponentName, mComponentPrice

Response.Write "<tr>"

Response.Write "<td>" & mComponentName
Response.Write "<input type='hidden' name='Component" &
mComponentCount & "' value='" & mComponentName & "' />"
Response.Write "</td>"

Response.Write "<td align='right'>" & mComponentPrice
Response.Write "<input type='hidden'
name='ComponentPrice" & mComponentCount & "' value='" & mComponentPrice &
"' />"
Response.Write "</td>"

Response.Write "</tr>"

mComponentTotal = mComponentTotal + mComponentPrice
Next

Response.Write "<tr><td align='right'><b>Total:</b></td><td>
" & mComponentTotal
Response.Write "<input type='hidden'
name='ComponentPriceTotal' value='" & mComponentTotal & "' />"
Response.Write "<input type='hidden' name='ComponentCount'
value='" & mComponentCount & "' />"
Response.Write "</td></tr>"

'END Display & DEBUGGING

Response.Write "<tr><td colspan='2'>"
Response.Write "This is not a sale, no payment is requsted at
this time. Please submit your order and a member of our sales team will
contact you."
Response.Write "</td></tr>"

Response.Write "</table>"

Response.Write "<input type=""submit"" value="" Submit to
sales team "" />"
Response.Write "</form>"
End If

%> </font>

<br /><br />

<form method=Post action=SelectBoxes.asp>
</form>
<% call GetSelectBoxes%>
<font face="Arial">

<table border="0" cellspacing="0">
<tr>
<td>
<input type=submit value=Go> <span lang="en-gb"></span>
</form>
</td>
<td>
<form method="post" action="SelectBoxes.asp"><input type="submit"
value=" Reset " /></form></font>
</form>
</td>
</table>

<font face="Arial" size="2">You can make as many changes as you require,
just select
<b>Go</b> again to update</font>

<%
Sub GetSelectBoxes()

if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true
Dim mCurrentSelectedValue

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'Create a line space between each box
Response.Write ("<br>")
'OK, create the new box.

sCurrentBox=oRS.Fields("Component_Type")
mCurrentSelectedValue = Request.Form(sCurrentBox)

Response.Write sCurrentBox & ": <select name=""" & sCurrentBox
& """>" & vbCrLf

end if

'Now add the individual item
Response.Write vbTab & "<option value=""" & oRS.Fields
("UniqueID") & """"

If mCurrentSelectedValue <> "" Then
If mCurrentSelectedValue = CStr(trim(oRS.Fields
("uniqueid"))) Then
Response.Write " selected "
End If
End If

Response.Write ">" & trim(oRS.Fields("Component_Name")) & " :
" & " " & trim(oRS.Fields("Price")) & "</option>" & vbCrLf
oRS.MoveNext

Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf
end if

Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%> </BODY>
</HTML>
================================================== ==================
sendEMail2.asp page
================================================== ==================

<%
Option Explicit
Response.Expires = -10000
%>

<%

Dim mEMailBody

Dim mComponentLoop
Dim mComponentCount

mComponentCount = Request.Form("ComponentCount")

Response.Write "This is the confirmation page.<br /><br />"

mEMailBody = mEMailBody & "<table border='0' cellspacing='1'
cellpadding='1' width='400'>"
mEMailBody = mEMailBody & "<tr><td><b>Component</b></td><td
align='right'><b></b></td></tr>"

For mComponentLoop = 1 to mComponentCount
mEMailBody = mEMailBody & "<tr>"
mEMailBody = mEMailBody & "<td>" & Request.Form("Component" &
mComponentLoop) & "</td>"
mEMailBody = mEMailBody & "<td align='right'>" & Request.Form
("ComponentPrice" & mComponentLoop) & "</td>"
mEMailBody = mEMailBody & "</tr>"
Next

mEMailBody = mEMailBody & "<tr><td align='right'><b>Total:</b></td><td>
" & Request.Form("ComponentPriceTotal") & "</td></tr>"
mEMailBody = mEMailBody & "</table>"

Response.Write mEMailBody
'start email section

Set JMail = Server.CreateObject ("JMail.SMTPMail")
JMail.ServerAddress = "hostserver.net" 'actual server address removed
JMail.Sender = Name
JMail.ReplyTo = Email
JMail.Subject = Subject
JMail.AddRecipient Recipient
JMail.Body = Name & Email & Tel & vbCrLf & BodyText
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Execute

Response.Redirect("formthanks.html")
Else
'do nothing, just display blank form

End IF
ODBCConnection.Close
Set ODBCConnection=Nothing

Response.Write "<form method='post' action='SendEMail.asp'>"
Response.Write "Name:<input type='text' name='Name' value='' /><br />"
Response.Write "EMail Address:<input type='text' name='EMail' value='' />
<br />"
Response.Write "Tel No:<input type='text' name='Tel' value='' /><br />"
Response.Write "<input type=""hidden"" name=""Recipient""
value=""sa***@company.co.uk"" /><br /> 'actual e-mail address removed
Response.Write "<input type=""hidden"" name=""BodyText"" value=""" &
mEMailBody & """ />"
Response.Write "<input type=""submit"" value="" Send EMail "" /><br />"
Response.Write "</form>"
%>

Jul 19 '05 #2
"grw" <no**@none.com> wrote in
news:ei**************@TK2MSFTNGP10.phx.gbl:
IE > tools > options > advanced > DONT show friendly errors will give
the true problem

I learn something new every day, thanks for that info.

I got

Microsoft VBScript compilation error '800a03ea'

Syntax error

/SendEMail2.asp, line 50

Else
^
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Lasse Edsvik | last post by:
Hello I use this code to send massmail with an attachment using JMail 4 proffessional. and the attachment seems to be attached but when i open it the first time my system32 folder opens..........
0
by: blair | last post by:
Hi: I'm trying to send a message using JMail with the following ASP code (using ADO to connect to MS Access database). : ____________________________________________ Set objRS1 =...
2
by: Amit Shinde | last post by:
Can anyone tell me how to send emails ..thru asp code? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
2
by: Droopy | last post by:
Hi, I try to implement a reusable socket class to send and receive data. It seems to work but I have 2 problems : 1) I rely on Socket.Available to detect that the connection is closed (no...
2
by: Ron | last post by:
Does anyone know of a free distributable mail package that is capable of sending simple mail messages from a web form? The reason I ask is because the server I am using doesn't have CDO enabled,...
2
by: rourou | last post by:
Hello everyone In VB.NET i can use Jmail to send a mai code Dim JMai JMail = Server.CreateObject("JMail.Message" JMail.silent = Tru JMail.Logging = Tru JMail.Charset = "gb2312
4
by: Schwarty | last post by:
I hope I posted this to the correct group. If not, please let me know and I will get it posted in the correct section. I have a web application developed in ASP.NET using C# for the code behind....
0
by: johnet | last post by:
Error: jmail.SMTPMail error '8000ffff' Cannot open file L:/ems/mail/hi.html Code: <% DIM strEmail, strFirstName, strLastName, strSubject, strComments, Mailer
4
by: cgrudzinski | last post by:
Hello, I have JMail working without attachments but now want to start using this feature. When using the .addattachment though the email received contains the binary data of the attachment - see...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.