Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2009, 05:43 PM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 6
Thanked 1 Time in 1 Post
Default Microsoft VBScript runtime error '800a000d' error

Hi there, as I've mentioned in earlier posts I'm a designer and just getting into the coding side of things. Been building a shopping cart using various plug ins and everything is going fine apart from when I try to send out the customers confirmation email.

I have two files. One called orderconfirmed.asp and another called functions_email.asp

In theory orderconfirmed.asp should trigger functions_email.asp and send an email to the customer (The whole process is triggered by IPN from Paypal hopefully)

So I'm getting this error:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'SendEmail'

/orderconfirmed.asp, line 69

Here's the order confirmed page with line 69 highlighted.

SendEmail CustomersRS("CustomerEmail")

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/CharonCart.asp" -->
<%
Dim OrderID,CustomerID
OrderID=Session("OrderID")
CustomerID=Request.Cookies("Products")("CustomerID ")
%>
<%
Dim CustomersRS__value
CustomersRS__value = "0"
if (CustomerID <> "") then CustomersRS__value = CustomerID
%>
<%
Dim OrderDetailsRS__value1
OrderDetailsRS__value1 = "0"
if (OrderID <> "") then OrderDetailsRS__value1 = OrderID
%>
<%
Dim OrdersRS__value
OrdersRS__value = "0"
if (OrderID <> "") then OrdersRS__value = OrderID
%>
<%
set CustomersRS = Server.CreateObject("ADODB.Recordset")
CustomersRS.ActiveConnection = MM_CharonCart_STRING
CustomersRS.Source = "SELECT * FROM Customers WHERE CustomerID=" + Replace(CustomersRS__value, "'", "''") + ""
CustomersRS.CursorType = 0
CustomersRS.CursorLocation = 3
CustomersRS.LockType = 3
CustomersRS.Open()
CustomersRS_numRows = 0
%>
<%
set OrderDetailsRS = Server.CreateObject("ADODB.Recordset")
OrderDetailsRS.ActiveConnection = MM_CharonCart_STRING
OrderDetailsRS.Source = "SELECT *,UnitPrice*Quantity as LineTotal FROM OrderDetails WHERE OrderID=" + Replace(OrderDetailsRS__value1, "'", "''") + ""
OrderDetailsRS.CursorType = 0
OrderDetailsRS.CursorLocation = 2
OrderDetailsRS.LockType = 3
OrderDetailsRS.Open()
OrderDetailsRS_numRows = 0
%>
<%
set OrdersRS = Server.CreateObject("ADODB.Recordset")
OrdersRS.ActiveConnection = MM_CharonCart_STRING
OrdersRS.Source = "SELECT * FROM Orders WHERE OrderID=" + Replace(OrdersRS__value, "'", "''") + ""
OrdersRS.CursorType = 0
OrdersRS.CursorLocation = 2
OrdersRS.LockType = 3
OrdersRS.Open()
OrdersRS_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
OrderDetailsRS_numRows = OrderDetailsRS_numRows + Repeat1__numRows
%>
<!--#include file="functions_email.asp" -->
<%
'This is the part where we send out emails.
'There's a 101 different ways of doing it.
'The function used are in the file functions_email.asp
'Basically you can edit the template in Email.asp, the function will send that page as a HTML email.
'So, you now have a choice to use CDONTS, JMail or ASP Mail. Just comment/uncomment the appropriate lines below

SendEmail CustomersRS("CustomerEmail")
'SendJmailEmail
'SendAspMailEmail
SendAspEmailEmail

'Uncomment this line to see whats sent.
'Response.Write Mailbody
'Response.End()

%>
<html>
<head>
<title>Order Confirmed</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="Styles.css">
</head>
<body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 bgcolor="#FFFFFF" onLoad="">
<!--#include file="Header.asp" -->
<div id="content">
<div id="breadCrumb">
</div>
<h2 id="pageName">Order Confirmed </h2>
<div class="story">
<table width="500" border="0" cellpadding="3">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="5" cellspacing="1" class="story">
<tr>
<td valign="top" bgcolor="white"><b>Contact Information</b></td>
<td width="50%" rowspan="2" valign="top" bgcolor="white"><strong>OrderID: <%=(OrdersRS.Fields.Item("OrderID").Value)%><br>
Date: </strong><%=(OrdersRS.Fields.Item("OrderDate").Value )%> </td>
</tr>
<tr>
<td width="50%" valign="top" bgcolor="white"> <%=(CustomersRS.Fields.Item("FirstName").Value)%>& nbsp;<%=(CustomersRS.Fields.Item("LastName").Value )%><b><br>
</b><br>
<b>Phone:</b> <%=(CustomersRS.Fields.Item("Phone").Value)%><br >
<b>Fax:</b> <%=(CustomersRS.Fields.Item("Fax").Value)%><br>
<b>Email:</b> <%=(CustomersRS.Fields.Item("CustomerEmail").Value )%></td>
</tr>
<tr bgcolor="#eeeeee">
<td width="50%" height="25"><b>Invoice details</b></td>
<td width="50%" height="25"><b>Delivery details</b></td>
</tr>
<tr bgcolor="white">
<td width="50%" valign="top" bgcolor="white"> <%=(CustomersRS.Fields.Item("BillingAddress1").Val ue)%><br>
<%=(CustomersRS.Fields.Item("BillingRegion").Value )%><br>
<%=(CustomersRS.Fields.Item("BillingCountry").Valu e)%><br>
<%=(CustomersRS.Fields.Item("BillingPostalCode").V alue)%><br>
</td>
<td width="50%" valign="top" bgcolor="white"><%=(CustomersRS.Fields.Item("Deliv eryAddress1").Value)%> <br>
<%=(CustomersRS.Fields.Item("DeliveryAddress2").Va lue)%><br>
<%=(CustomersRS.Fields.Item("ShipCity").Value)%><b r>
<%=(CustomersRS.Fields.Item("BillingCountry").Valu e)%><br>
<%=(CustomersRS.Fields.Item("ShipPostalCode").Valu e)%></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="story">
<tr bgcolor="#eeeeee" class="tableheader">
<td width="6%" valign="middle"><b>Qty</b></td>
<td width="35%" valign="middle"><b>Item</b></td>
<td width="13%" valign="middle"><strong>Size</strong></td>
<td width="13%" valign="middle"><strong>Colour</strong></td>
<td width="19%" height="25" align="right" valign="middle"><b>Unit
Price</b></td>
<td width="14%" align="right" valign="middle"><b>Total</b></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT OrderDetailsRS.EOF))
%>
<tr bgcolor="#FFFFFF">
<td align=center valign=middle bgcolor=#FFFFFF><%=(OrderDetailsRS.Fields.Item("Qu antity").Value)%> </td>
<td height="30" valign="middle" bgcolor=#FFFFFF><%=(OrderDetailsRS.Fields.Item("Pr oductName").Value)%><br>
</td>
<td valign=middle bgcolor=#FFFFFF><%=(OrderDetailsRS.Fields.Item("Pr oductSize").Value)%></td>
<td valign=middle bgcolor=#FFFFFF><%=(OrderDetailsRS.Fields.Item("Co lour").Value)%></td>
<td align="right" valign=middle bgcolor=#FFFFFF>&pound;<%= FormatNumber((OrderDetailsRS.Fields.Item("UnitPric e").Value), 2, -2, -2, -2) %></td>
<td align="right" valign=middle bgcolor=#FFFFFF>&pound;<%= FormatNumber((OrderDetailsRS.Fields.Item("LineTota l").Value), 2, -2, -2, -2) %></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
OrderDetailsRS.MoveNext()
Wend
%>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="1" class="story">
<tr>
<td width="32%" rowspan="5" valign="top">&nbsp;</td>
<td width="68%" align="right"> Total:&pound;<%= FormatNumber((OrdersRS.Fields.Item("SubTotal").Val ue), 2, -2, -2, -2) %> </td>
</tr>
<tr>
<td align="right">Discount:&pound;<%= FormatNumber((OrdersRS.Fields.Item("Discount").Val ue), 2, -2, -2, -2) %></td>
</tr>
<tr>
<td align="right">Shipping:&pound;<%= FormatNumber((OrdersRS.Fields.Item("Freight").Valu e), 2, -2, -2, -2) %> </td>
</tr>
<tr>
<td align="right"> <b>Grand Total: &pound;<%= FormatNumber((OrdersRS.Fields.Item("GrandTotal").V alue), 2, -2, -2, -2) %> </b> </td>
</tr>
<tr>
<td align="right">(VAT:&pound;<%= FormatNumber((OrdersRS.Fields.Item("SalesTax").Val ue), 2, -2, -2, -2) %>)</td>
</tr>
</table></td>
</tr>
</table>
<table width="500" border="0">
<tr align="center" valign="top">
<td class="story">
<p>Thank you for your order. Please <a href="javascript:window.print()">print
this page</a> if you require an invoice.</p> </td>
</tr>
</table>
<p>
<!--#include file="footer.asp" -->
</p>
</div>
<div class="story"></div>
</div>
<!--#include file="NavBar.asp" -->
</body>
</html>
<%
'Uncomment the following lines to abandon the Session and kill the cart
'Session.Abandon
'Response.Cookies("CharonCart")=""
%>
<%
CustomersRS.Close()
%>
<%
OrderDetailsRS.Close()
%>
<%
OrdersRS.Close()
%>

and my email_functions page

<title>???</title><%
'Start the functions
%>
function SendEmail(c)
Set objMail = Server.CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.

objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="???"
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

' If your server requires outgoing authentication uncomment the lines below and use a valid email address and password.
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]???.co.uk"
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="???"

objMail.Configuration.Fields.Update

'End remote SMTP server configuration section==

objMail.From = "[email protected]???.co.uk"
objMail.To = c
objMail.Bcc = "[email protected]???.co.uk" 'Maybe send a CC to your sales office
objMail.Subject = "Your order from ???"
objMail.HTMLBody = Mailbody
'objMail.TextBody = mailbody
'objMail.MailFormat=0
'objMail.BodyFormat=0
objMail.Send
Set objMail = Nothing
end function
%>

As I say I'm new to coding so I appologies if it's a stupid mistake on my part. I've been banging my head against a brick wall on it so any help is really appreciated.

Thanks in advance
David
 
Old November 4th, 2009, 06:03 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I suspect this line:

SendEmail CustomersRS("CustomerEmail")

Should be commented out in your code. It does nothing as far as I can see. In any case the above line is useless. If SendMail was a variable and it said:

SendEmail = CustomersRS("CustomerEmail")

That would make sense. Looking into your code SendMail is a function and is used like so:

function SendEmail(c)

And then further down your code the value in the parameter 'c' is used for the to address:

objMail.To = c

Therefore this makes me think you need to change:

SendEmail CustomersRS("CustomerEmail")

To

SendEmail(CustomersRS("CustomerEmail"))

What this does is pass the email address in CustomerRS("CustomerEmail") into the function
__________________
Wind is your friend
Matt
The Following User Says Thank You to mat41 For This Useful Post:
futurehype (November 9th, 2009)
 
Old November 8th, 2009, 09:58 AM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 6
Thanked 1 Time in 1 Post
Default objMail.CreateMHTMLBody

Hi thanks for all the help. I've got the email sending, but it's only sending a link to the page that I would like to send.

if I use objMail.CreateMHTMLBody I don't get the email at all.

Is there another way of sending a asp page with a couple of variables like orderid etc to a customers email as well as mine?

This is my code as it stands again.

<title>???.co.uk ???</title>
<%
function SendEmail(c)
Set objMail = Server.CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.

objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="???l"
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

' If your server requires outgoing authentication uncomment the lines below and use a valid email address and password.
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]???.co.uk"
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="???"

objMail.Configuration.Fields.Update

'End remote SMTP server configuration section==

objMail.From = "[email protected]???.co.uk"
objMail.To = c
objMail.Bcc = "[email protected]???.co.uk" 'Maybe send a CC to your sales office
objMail.Subject = "Your order from ???"
objMail.HTMLBody = "http://www.???.co.uk/email.asp?OrderID=" & OrderID& "&CustomerID=" & CustomerID
objMail.TextBody = "http://www.???.co.uk/email.asp?OrderID=" & OrderID & "&CustomerID=" & CustomerID
'objMail.MailFormat=0
'objMail.BodyFormat=0
objMail.Send
Set objMail = Nothing
end function
%>

Thanks again for your help.
 
Old November 8th, 2009, 06:17 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;Hi thanks for all the help. I've got the email sending, but it's only sending a link to the page that I would like to send.

But thats alll you have in the 'objMail.HTMLBody' line so thats all it will send. Place more info here to include it in the body of the email. Why are you using this line:

objMail.TextBody

I cant imagine why you would use both.......Anyhow, your mail code is not in the CDOSYS (which is the reccomended mail method) format I believe to be the reccomended syntax; What I use is:

<%
function SendEmail(c)
Const cdoSendUsingPort = 2
Dim iMsg,iConf,Flds,strHTML,strSmartHost
StrSmartHost = "10.?.?.?" 'place you SMTP address here
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/con...tion/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/con...nectiontimeout") = 10
.Update
End With
With iMsg
Set .Configuration = iConf
.To = trim(request.form("tEmail"))
.From = Mail_From
.Subject = "Some subject"
.HTMLBody = "Your message body"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
end function
%>
__________________
Wind is your friend
Matt
The Following User Says Thank You to mat41 For This Useful Post:
futurehype (November 9th, 2009)
 
Old November 8th, 2009, 07:01 PM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 6
Thanked 1 Time in 1 Post
Default CreateMHTMLBody

Hi, thanks again for the help. I've used your code to tidy up the sending page, and I've changed some of the code so I can send a webpage that I have on my server but sadly it's still just sending a link not the actual page.

I thought and have read that CreateMHTMLbody converts the address in the code and encapsulates it into a webpage which is then sent as an email. Am I wrong on this. I've used this:

.CreateMHTMLBody = "http://www.???.co.uk/email.asp?OrderID=" & OrderID & "&CustomerID=" & CustomerID"

and when I type it into my browser it brings up the correct page and as I've mentioned the email you've helped me with works and send to both me and the customer. Can you see anything wrong with what I'm doing?

Thanks again

<%
function SendEmail(c)
Const cdoSendUsingPort = 2
Dim iMsg,iConf,Flds,strHTML,strSmartHost
StrSmartHost = "???" 'place you SMTP address here
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="[email protected]???.co.uk"
.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="???"
.Update
End With
With iMsg
Set .Configuration = iConf
.To = c
.From = [email protected]???.co.uk
.Subject = "Your order from ???"
.CreateMHTMLBody = "http://www.???.co.uk/email.asp?OrderID=" & OrderID & "&CustomerID=" & CustomerID"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
end function
%>
 
Old November 8th, 2009, 07:45 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

agghhhh I see, I mis understood your issue. To be honest I have never used this .CreateHTMLBody

Interesting, I will give it a try and get back to you. Are you getting ay kind of error? I would say it would be related to the page you are trying to display. Do you use a <!DOCTYPE...... tag if so what is it. Try removing it and re-trying.

Let me have a go at it, will get back to you
__________________
Wind is your friend
Matt
The Following User Says Thank You to mat41 For This Useful Post:
futurehype (November 9th, 2009)
 
Old November 8th, 2009, 07:56 PM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 6
Thanked 1 Time in 1 Post
Default

Hi I'm not getting an error, as I'm using a paypal IPN to go through a page that then triggers mt email to client page.

I just wanted the customer to get the email as well as myself as a reminder that there had been an order.

At the moment all that comes through is the link. It probably doesn't look too professional, but with the ability of my coding at the moment i doubt the rest of it looks too professional anyway. But I'll keep trying. Thanks for you help. It's most appreciated.

David
 
Old November 8th, 2009, 07:58 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Yes I would say its an issue with the code on your destination page. It works for me using this line of code. Try replacing you destination with myn below, at least we know this works.

.CreateMHTMLBody("http://www.elitemarquees.com.au/index.asp")

Does this work for you? If so replace it with your path without the querystrings. if your path works without the QS's then this would be the problem area. Trial and error/babby steps like this will lead you to the problem area

BTW - my doc type tag is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

I have seen issues that have been caused by setting this tag to strict
__________________
Wind is your friend
Matt
The Following User Says Thank You to mat41 For This Useful Post:
futurehype (November 9th, 2009)
 
Old November 8th, 2009, 08:02 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

aggghhh I see whats wrong!!! get rid of the =, use brackets and trailing double quotes. EG note the difference between your original code and this:

.CreateMHTMLBody("http://www.???.co.uk/email.asp?OrderID=" & OrderID & "&CustomerID=" & CustomerID & "")
__________________
Wind is your friend
Matt
The Following User Says Thank You to mat41 For This Useful Post:
futurehype (November 9th, 2009)
 
Old November 9th, 2009, 07:58 PM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 6
Thanked 1 Time in 1 Post
Default Thanks

Thanks for your help, I've got it working now and feel like I have a much better understanding of the process.

Been asking around on a few other forums and your advice was the only one that worked so thanks again.

David





Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft VBScript runtime error '800a01a8' Abbas Classic ASP Professional 1 July 21st, 2006 11:42 AM
VBScript runtime error '800a000d' on DLL hit crmpicco Pro VB 6 1 February 16th, 2006 01:47 PM
Microsoft VBScript runtime error '800a000d' mwlyoung Classic ASP Databases 3 April 15th, 2004 04:54 AM
Microsoft VBScript runtime error '800a01a8' dlgee Classic ASP Basics 4 January 25th, 2004 05:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.