Wrox Programmer Forums
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO 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 22nd, 2004, 10:43 AM
Authorized User
 
Join Date: Jan 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending email with CDOSYS

I am trying to send email using CDOSYS. Right now I use CDONTS and because we are going to a different platform I have to change all of my forms to send using CDOSYS. Specifically I need to know how to pull form variables. If someone could PLEASE post an example using CDOSYS, I would greatly appreciate it.

Thanks,
Tee
 
Old January 30th, 2004, 04:09 PM
Registered User
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dude, I pasted the old CDONT along with the CDOSYS format for you to compare the difference. The "your.home.org" should be changed to your own mail setting. It works great on mine, hopefully yours too.

=========
'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your.home.org"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "[email protected]"
objCDOSYSMail.To = "[email protected]"
objCDOSYSMail.BCC = "[email protected]"
objCDOSYSMail.Subject = "Subject goes here"
objCDOSYSMail.HTMLBody = "html enhanced email message goes here"
objCDOSYSMail.Send
'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing



'commented out: below is CDONTS object.

'Set objNewMail = CreateObject("CDONTS.NewMail")

'objNewMail.From = "[email protected]"
' objNewMail.To = "[email protected]"
'objNewMail.Bcc = "[email protected]"
'objNewMail.Cc = "[email protected]"
'objNewMail.BodyFormat=0
'objNewMail.MailFormat=0
'objNewMail.Subject = "Subject goes here"
'objNewMail.Body= "Body

'objNewMail.Send

'set objNewMail=nothing

%>

Quote:
quote:Originally posted by Tee88
 I am trying to send email using CDOSYS.#29259;Right now I use CDONTS and because we are going to a different platform I have to change all of my forms to send using CDOSYS.#29259;Specifically I need to know how to pull form variables.#29259;If someone could PLEASE post an example using CDOSYS, I would greatly appreciate it.#29259;

Thanks,
Tee
 
Old February 19th, 2004, 01:42 PM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Danniken,
I'm using code that's pretty much exactly what you posted.
But when I view the page, I get an error type 0x8004020E, "Cannot
modify or delete an object that was added using the COM+ Admin SDK".
Someobdy else suggested adding the following lines of code in my page:




But it didn't solve anything.
Anybody have any ideas?

 
Old February 19th, 2004, 03:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did you install the Collaboration Data Objects for Window 2000 or for Exchange?
These components are required for the CDO.Message to work.

Check out this article for a comparison of the two methods, and their requirements.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 19th, 2004, 04:27 PM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,
I'm not sure what you mean. I'm running Windows XP pro with IIS 5.1 installed.

I've got cdosys.dll in my windows/system directory. Is this the same as having them installed?

 
Old February 19th, 2004, 04:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If it is registered, yes, it;s the same. Since the file is there, I assume it's registered as well.

Can you post your code? The code I used in my example runs fine on my Windows XP Pro edition.

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 20th, 2004, 11:47 AM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's my code:

Sub autoMail(name, address, which)
  dim password
  dim objMessage, objConfig, Flds
  dim subject, body

  password = "#####"
  set objMessage = Server.createObject("CDO.message")
  set objConfig = server.createObject("CDO.Configuration")
  set Flds = objConfig.Fields
  Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
  Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "####"
  Flds.Item("http://schemas.microsoft.com/cdo/configuratino/sendpassword") = "####"
  Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "myams.org"
  Flds.Update

  Select Case which
    case "0"
      body = autoMailEvent(name)
      subject = "Queen's Bands Strike Notification"
    case "1"
      subject = "Queen's Bands Event Reminder"
      body = autoMailStrike(name)
    End Select

  Set objMessage.Configuration = objConfig
  objMessage.From = "Queens Bands"
  objMessage.To = address
  objMessage.Subject = subject
  objMessage.HTMLBody = body
  objMessage.Send

  set Flds = Nothing
  Set objConfig = Nothing
  Set objMessage = Nothing

End Sub

At the start of my page, before I do anything, I have



Thanks for your help,
Mike

 
Old February 20th, 2004, 12:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This is odd. This code runs fine on my machine, after I changed the SMTP server of course.

AFAIK, it should work just like that. A few things you could check:

1. Are you running any firewall / anti-virus software? Maybe it's blocking this code (not likely, but you never know).

2. You could reinstall the CDO stuff. If you have an Outlook disk, or Office Disk that has Outlook included, start the Setup and choose "Collaboration Data Objects", which you'll find under Microsoft Outlook.

Other than that, I am pretty much stumped with this.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 19th, 2004, 05:55 PM
Registered User
 
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just wanted to say thanks!! that worked really well for me.
Never got SQLMail to work from SQL Server but that worked the first time.
Thanks again,surfponto

[quote]Originally posted by Danniken
 Dude, I pasted the old CDONT along with the CDOSYS format for you to compare the difference. The "your.home.org" should be changed to your own mail setting. It works great on mine, hopefully yours too.

=========
'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your.home.org"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update



 
Old April 29th, 2004, 08:42 PM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi






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
Sending email maitias C# 2005 2 February 17th, 2006 11:24 AM





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