Print Page | Close Window

asp, cdosys errors

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=25969
Printed Date: 29 March 2026 at 8:40am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: asp, cdosys errors
Posted By: Dan H
Subject: asp, cdosys errors
Date Posted: 16 July 2008 at 5:43pm
Using cdosys to send email in asp - I need to pass variables in form or querystring on email for link. I pretty much get a variety of errors whenever I attempt to string the variables. 

oMail.CreateMHTMLBody " http://yepdata.com/EmailStuff.asp?A= - http://yepdata.com/EmailStuff.asp?A= " & AA & "&B=" & BB

This gives me 'unterminated string' errors, and trying to build a form just leaves it speechless.

I also tried to set cookies to hold the variables and sent the page without a querystring, the page showed up - but it never found the cookies. Any thoughts?




Replies:
Posted By: Jono
Date Posted: 16 July 2008 at 7:58pm
It looks okay to me. Do you get the same error if you put the url into a variable first? Or does it need Server.HTMLEncode?


Posted By: Dan H
Date Posted: 16 July 2008 at 8:16pm
Thanks for the response.
Yes- I built the string and named it. The error msg was identical.
Server.HTMLEncode? Never heard of it...
How's that work? (Not a .Net thing, right?)
Dan


Posted By: Dan H
Date Posted: 16 July 2008 at 9:53pm

oMail.CreateMHTMLBody server.HTMLEncode("http://yepdata.com/EmailIStuff.asp?A=" & AA & "&B=" & BB & "&C=" & CC)

didn't work, and about a dozen variations failed as well.
What am I doing wrong here?
Dan


Posted By: Dan H
Date Posted: 17 July 2008 at 2:16am
Here's a thought - WebWizForums uses code to generate the email notification that a reply has been posted. This has a querystring, and is probably exactly what I'm looking for! Anybody know what the code looks like? (I'm kind of making myself nuts here trying to get this to work!)


Posted By: Jono
Date Posted: 17 July 2008 at 7:23pm
Hi,
 
Gave you the wrong, but similar function. You may wish to try URLEncode (see: http://msdn.microsoft.com/en-us/library/ms525738.aspx - http://msdn.microsoft.com/en-us/library/ms525738.aspx )
 
Jono


Posted By: Jono
Date Posted: 17 July 2008 at 7:32pm
Originally posted by Dan H Dan H wrote:

oMail.CreateMHTMLBody " http://yepdata.com/EmailStuff.asp?A= - http://yepdata.com/EmailStuff.asp?A= " & AA & "&B=" & BB

This gives me 'unterminated string' errors, and trying to build a form just leaves it speechless.

I also tried to set cookies to hold the variables and sent the page without a querystring, the page showed up - but it never found the cookies. Any thoughts?

 
Going back to your original issue, have you performed a response.redirect to the generated URL and does it work?
 
Can you try a simple URL e.g. " http://domain.com/page.asp?a= - http://domain.com/page.asp?a= " & a
 
Also, looks like cookies need to be defined when creating the object: http://msdn.microsoft.com/en-us/library/ms527024%28EXCHG.10%29.aspx - http://msdn.microsoft.com/en-us/library/ms527024(EXCHG.10).aspx
 
 
Jono


Posted By: Dan H
Date Posted: 17 July 2008 at 11:27pm
Interesting news!
This works:
<head><title>emailtest</title></head>
<body>
<%
A=1234
AA= http://yepdata.com/roadwarrior/test.asp?A= - http://yepdata.com/roadwarrior/test.asp?A= & A
Set oMail = Server.CreateObject("CDO.Message")
Set oMailConfig = Server.CreateObject ("CDO.Configuration")
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
oMailConfig.Fields.Update
Set oMail.Configuration = oMailConfig
oMail.From = "dan@yepdata.com"
oMail.To = "dharr1@cox.net"
oMail.Subject = "test page test.asp"
oMail.createMHTMLBody AA
oMail.Send
Set oMail = Nothing
Set oMailConfig = Nothing
%>
</body></html>
This code was taken from http://www.ASPDev.org - www.ASPDev.org , and it also seems to support multiple variables in the querystring. The configuration stuff must have made the difference.
Thanks for the help, Jono.
Dan H


Posted By: Jono
Date Posted: 18 July 2008 at 5:09pm
No problems - glad you got it working. It's probably a bit late now, but Paul Sadowski's site is quite useful: http://www.paulsadowski.com/WSH/cdo.htm - http://www.paulsadowski.com/WSH/cdo.htm  Smile


Posted By: Dan H
Date Posted: 18 July 2008 at 6:13pm
It's never too late for a good tip.
Thanks.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net