Variable is undefined: 'JMail' help?

K

Kingdom

Having a problem with a jmail email script and cannot seem to solve this
error any sugestions welcome.


Error shows in browser as

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'JMail'

/SendEMail2.asp, line 38


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



<%

Dim mComponentLoop
Dim mComponentCount

mComponentCount = Request.Form("ComponentCount")

If Request.Form("name") <> "" Then

Dim EMail, Name, Tel, Recipient, Subject

EMail = Request.Form("EMail")
Name = Request.Form("Name")
Tel = Request.Form("Tel")
Recipient = Request.Form("Recipient")
Subject = "Potential customer interest"

'start email section

'**************** COMMENT THIS OUT TO SEND JMAIL ******
'Response.Write "This is just the confirmation page.<br /><br />"
'Response.Write "Name:" & Name & "<br />"
'Response.Write "EMail:" & EMail & "<br />"
'Response.Write "Tel:" & Tel & "<br />"
'Response.Write "Recipient:" & Recipient & "<br />"
'Response.Write "Subject:" & Subject & "<br />"
'Response.Write "BodyText:" & Request.Form("bodytext")
'Response.End
'*****************************************************

Set JMail = Server.CreateObject ("JMail.SMTPMail")
JMail.ServerAddress = "actual 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
Set jMail = Nothing


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

'End IF
ODBCConnection.Close
Set ODBCConnection=Nothing

Else

Dim mEMailBody
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

Response.Write "<form method='post' action='SendEMail2.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=""(e-mail address removed)"" /><br />"
Response.Write "<input type=""hidden"" name=""BodyText"" value=""" &
mEMailBody & """ />"
Response.Write "<input type=""submit"" value="" Send EMail "" /><br />"
Response.Write "</form>"

End If
%>
 
S

Steven Burn

Looks like you've forgotten to Dim JMAIL which is probably the cause of the
error.

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
A

Aaron Bertrand - MVP

yup, thanks

Wow, I scrolled all the way down for that?

The delete key is your friend, really. :)
 
J

John Beschler

Aaron,

I love reading your posts. I get a chuckle from you almost
everytime I check in here.

Keep up the good work!

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top