473,394 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 4005
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.