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 April 17th, 2005, 08:14 PM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do you use CDOSYS mail

Hi,

Until recently I had been using CDONTS to allow people to send mail via a form.

We recently upgraded to IIS 6, Windows 2003 and my form no longer works. I understand that CDONTS is not included with Windows 2003.

I managed to find an example of CDOSYS on the MS KB site(http://msdn.microsoft.com/library/de...cdosys_vbs.asp).

I'm a total newbie though, and it doesn't make much sense.

Just wondering if someone can describe in fairly basic terms how to convert my CDONTS mail code to CDOSYS.

This is my code:
Code:
Request.Form("form1")

Dim fName, surname, comments, cb1, cb2

Dim theMail

fName = Request.Form("fName")
surname = Request.Form("surname")
comments = Request.Form("comments")
cb1 = Request.Form("cb1")
cb2 = Request.Form("cb2")

        Set theMail = Server.CreateObject("CDONTS.NewMail")

        theMail.From = "me@myemail.com"

        theMail.To = "me@myemail.com"

        theMail.Cc = "me@myemail.com"

        theMail.Bcc = ""

        theMail.Subject = "Form Submission"


theMail.Body = "Firstname; " & fName & "<br>" & _
        "Surname; " & surname & "<br>" & _
        "Position; " & position & "<br>" & _
        "Comments/Questions; " & comments & "<br>" & _
        "Checkbox1; " & cb1 & "<br>" & _
        "Checkbox2; " & cb2 & "<br>" 

theMail.BodyFormat = 0

        theMail.MailFormat = 0
        theMail.Send
        Set theMail = nothing
 %>
Thanks very much

S

 
Old April 17th, 2005, 08:30 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 an overview including a working example:

http://www.webafrica.co.za/kb/sendin..._overview.html

;;;my form no longer works
Your form still works, you just dont have the CDONTS.dll You can make it work by downloading and registering this .dll

I believe CDONTS is considered old and is no longer present by default. If you have allot of pages to change, it would be easier making CDONTS work.

Wind is your friend
Matt
 
Old April 17th, 2005, 09:24 PM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Matt,

I tried adapting the code from the link you siggested but I get the following error:
error '80040211'

I already got the IT guys to install CDONTS.dll, but then I got a permission error. I've let them know, and I think they should be able to fix it.

Given the Microsoft recommend using CDOSYS instead of CODONTS, I wanted to see if I could get it to work, but from searching around the web it seems lots of people have had issues with it. Seems like it's more trouble than it's worth.

Any more tips greatly appreciated,
Thanks
S

 
Old April 17th, 2005, 09:36 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 agree CDOSYS would be better. I have not used CDOSYS, its about time I did. I am working om something at the moment, when I have finished I will get CDOSYS working and send you the code - it will be shortly.

About the permission error, strange...
As I said before, I have allot of pages using CDONTS so I simply registered the .dll and it worked without a problem. It would seem they have registered it otherwise you would be getting an error when it references the library file. I will get back to you...


Wind is your friend
Matt
 
Old April 19th, 2005, 10:33 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

Sorry I got a bit busy. I have tested this on a 2003 server, the code is strait from the MS website. If this doesnt work for you its not the code, its your SMTP set up (or the lack of), firewall, etc..

<!--
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 = "your mail IP - is a string"
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 = "aValidAddress@somePlace.com"
.From = "someOtherAddress@somePlace.com"
.Subject = "CDOSYS Test"
.HTMLBody = "sent using CDOSYS"
.Send
End With

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

BTW: I had no trouble getting this to work. In fact I have just tryed it on a server that was not happy sending external (outside our network) mail using CDONTS. This method works like a charm.

Wind is your friend
Matt
 
Old April 20th, 2005, 10:56 PM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help, Matt.

It turns out we haven't got SMTP server at the moment! I think the code should work once they get it set up.

cheers

s






Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Mail Using CDOSYS in ASP artarasan Classic ASP Basics 1 May 12th, 2008 06:11 PM
CDOSYS Mail component error shrisangeeta Classic ASP Basics 1 May 5th, 2007 06:01 AM
mail through cdosys.dl Amit singla ASP.NET 1.0 and 1.1 Professional 3 October 26th, 2006 06:41 AM
CDOSYS Bob Bedell Pro VB 6 1 February 14th, 2006 10:16 AM





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