Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 January 16th, 2006, 09:24 PM
Authorized User
 
Join Date: Mar 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error on mail object .send

Good evening!

Hope someone out there can help me out with this:

I have made an online evaluation which collects responses from an online form and forwards a completion receipt via email to a named party before putting the data in an access database.

I get the following error on the 'objCMail.Send' line:

----------------------------------------
Microsoft VBScript runtime error '800a01a8'

Object required: "

/hls/Lskills06/thanks.asp, line 176
----------------------------------------


The code used to handle the e-mail is:
-------------------------------------
<%
    dim objCMail
    Set objCMail = Server.CreateObject("CDONTS.NewMail")
    objCMail.From = mail
    objCMail.To = tutor
    objCMail.Subject = mail & " has completed evaluation for " & course & " stage " & stage
    objCMail.BCC = "[email protected]"
    objCMail.Body = mail & " completed evaluation for " & language & " stage " & stage & " on " & thedate & " at " & thetime & "."
    objCMail.Send
    Set objCMail = nothing
%>
-----------------------------------

Any ideas what I'm doing wrong here? I have used almost identical mail handlers for other forms.

Heidi
 
Old January 16th, 2006, 09:35 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

You are using a mail method that MS are suggesting not to use any more. The reason being:

Ref: http://support.microsoft.com/?id=315197

"Microsoft Windows Server 2003 does not install Collaboration Data Objects (CDO) for NTS (CDONTS). Therefore, applications that use CDONTS do not function on a Windows Server 2003-based computer."

You can instal the cdonts.dll and make it work (search your web server for the cdonts.dll if its there your mail should work, if not, it will not) however I use CDOSYS now - IMO the best method to use. The syntax is:

<!--
Sending SMTP mail via port 25 using CDOSYS This ASP page
uses CDOSYS to send SMTP mail using port 25 of the SMTP
server that is set. The e-mail delivery is handled by the
SMTP server that is set in the configuration object.
-->
<%
Const cdoSendUsingPort = 2
Dim iMsg,iConf,Flds,strHTML,strSmartHost
StrSmartHost = "192.168.0.0"
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

'set the CDOSYS configuration fields to use port 25 on the SMTP server
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") = 10
   .Update
End With

'apply the settings to the message
With iMsg
   Set .Configuration = iConf
   .To = "someRealAddress"
   .From = "someOtherRealAddress"
   .Subject = "CDOSYS Test"
   .HTMLBody = "Sent using CDOSYS..."
   .Send
End With

' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

%>



Wind is your friend
Matt
 
Old January 16th, 2006, 09:37 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

BTW your CDONTS syntax looks correct to me. Make sure you From and To addresses are real addresses - this can sometimes be a problem.

Are you using 2003 server?

Wind is your friend
Matt
 
Old January 16th, 2006, 09:48 PM
Authorized User
 
Join Date: Mar 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your reply, Matt.

I'm using 2000 server, and the CDONTS seems to work OK here. Good tip about the CDOSYS though - I'm so beginner at this, I didn't know CDONTS wasn't supported on 2003 - best to get compliant before our next upgrade!

However - it appears that my e-mails ARE sent and received too, even though the error comes up for that line. And the error remains even if I remove the whole mail part, which I find kind of strange... So I'm probably missing something - possibly a " somewhere - I just have to find it!

 
Old January 16th, 2006, 10:37 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

Here is a useful link:
http://www.w3schools.com/asp/asp_send_email.asp

I will run your code on my server here however I beleive your syntax is correct.

;;;However - it appears that my e-mails ARE sent and received too
mmmm, very strange

When you do a search for the cdonts.dll where is it located?

Wind is your friend
Matt
 
Old January 16th, 2006, 10:43 PM
Authorized User
 
Join Date: Mar 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just found the error! There was a space too many in the path to the msado15.dll file and now it runs without error. *Blushing at typo*

Now all I have to do is find out where my two missing variables drop out on their way from A to B, and then I think I'm sorted. Thanks again for your help, Matt:)

Heidi

 
Old January 16th, 2006, 10:49 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

No worries glad you sorted it. For anybody who needs the cdonts.dll http://dll.yaroslavl.ru/index.php3?lng=&in_char=C

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
mail send error :page cannot be displayed KamalRaturi ASP.NET 2.0 Professional 2 May 5th, 2008 10:59 AM
error in send mail in arabic langauge boda2005 Classic ASP Professional 0 February 15th, 2008 07:08 PM
Mail.send error (attachement > 100KB) max_manu Classic ASP Basics 0 June 27th, 2006 12:57 PM





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