IIS and SMTP - CDO on XP Help

This is Interesting: Free IT Magazines  
Home > Archive > IIS and SMTP > January 2004 > CDO on XP Help





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author CDO on XP Help
Glenn

2004-01-24, 2:04 am

Using XP IIS CDO to send a mail from a VB Script. The
following works NOTE: Usinf the Microsoft config

' sch
= "http://schemas.microsoft.com/cdo/configuration/"
' Set cdoConfig = CreateObject("CDO.Configuration")
' With cdoConfig.Fields
' .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
' .Item(sch & "smtpserver") = "mail.somewhere.org"
' .update
' End With

' Set cdoMessage = CreateObject("CDO.Message")
' With cdoMessage
' Set .Configuration = cdoConfig
' .From = "from@me.com"
' .To = "GRonken@somewhere.org"
' .Subject = "Sample CDO Message"
' .TextBody = "This is a test for CDO.message"
' .Send
' End With
'
' Set cdoMessage = Nothing
' Set cdoConfig = Nothing

So know I wanted to use the local machine library so I
used -

Dim iMsg
Set iMsg = CreateObject("CDO.Message")
Dim iBp
Dim Flds

Dim iConf
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.lmhealth.org"
Flds(cdoSMTPServerPort) = 25
Flds(cdoSMTPAuthenticate) = cdoAnonymous ' 0
Flds.Update

With iMsg
Set .Configuration = iConf
.To = "GRonken@somewhere.org"
.From = "GRonken@somewhere.org"
.Sender = "The_FTP_Server"
.Subject = "Files for Monday's meeting."
.TextBody = "Please review the attached files for
Monday's meeting. Thanks." + vbLfCr + vbLfCr

iBp.ContentMediaType="text/html"

.Send
End With

I receive a script error

Arguments are of the wrong type, are out of acceptable
range, or are in conflict with one another

CODE: 800AOBB9
SOURCE: ADODB.Fields

HELP ......

Alex Feinman [MVP]

2004-01-24, 2:04 am

If this is ASP page, you cannot use constants like cdoSendUsingMethod or
cdoSMTPAuthenticate unless you have included a meta tag pointing to the type
library

<!--METADATA TYPE="TypeLib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDOSYS"-->

Alternatively you can use the literal constants - the values are available
in the SDK include files


"Glenn" <anonymous@discussions.microsoft.com> wrote in message
news:0a9401c3c0b8$08314cf0$a301280a@phx.gbl...
quote:

> Using XP IIS CDO to send a mail from a VB Script. The
> following works NOTE: Usinf the Microsoft config
>
> ' sch
> = "http://schemas.microsoft.com/cdo/configuration/"
> ' Set cdoConfig = CreateObject("CDO.Configuration")
> ' With cdoConfig.Fields
> ' .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
> ' .Item(sch & "smtpserver") = "mail.somewhere.org"
> ' .update
> ' End With
>
> ' Set cdoMessage = CreateObject("CDO.Message")
> ' With cdoMessage
> ' Set .Configuration = cdoConfig
> ' .From = "from@me.com"
> ' .To = "GRonken@somewhere.org"
> ' .Subject = "Sample CDO Message"
> ' .TextBody = "This is a test for CDO.message"
> ' .Send
> ' End With
> '
> ' Set cdoMessage = Nothing
> ' Set cdoConfig = Nothing
>
> So know I wanted to use the local machine library so I
> used -
>
> Dim iMsg
> Set iMsg = CreateObject("CDO.Message")
> Dim iBp
> Dim Flds
>
> Dim iConf
> Set iConf = CreateObject("CDO.Configuration")
> Set Flds = iConf.Fields
>
> Flds(cdoSendUsingMethod) = cdoSendUsingPort
> Flds(cdoSMTPServer) = "mail.lmhealth.org"
> Flds(cdoSMTPServerPort) = 25
> Flds(cdoSMTPAuthenticate) = cdoAnonymous ' 0
> Flds.Update
>
> With iMsg
> Set .Configuration = iConf
> .To = "GRonken@somewhere.org"
> .From = "GRonken@somewhere.org"
> .Sender = "The_FTP_Server"
> .Subject = "Files for Monday's meeting."
> .TextBody = "Please review the attached files for
> Monday's meeting. Thanks." + vbLfCr + vbLfCr
>
> iBp.ContentMediaType="text/html"
>
> .Send
> End With
>
> I receive a script error
>
> Arguments are of the wrong type, are out of acceptable
> range, or are in conflict with one another
>
> CODE: 800AOBB9
> SOURCE: ADODB.Fields
>
> HELP ......
>




Glenn

2004-01-24, 2:04 am

This isn't an ASP page.. .... using VB Script actually
out of CuteFTP Pro .... if I point to the Microsoft site
for the schema it works fine ....
quote:

>-----Original Message-----
>If this is ASP page, you cannot use constants like


cdoSendUsingMethod or
quote:

>cdoSMTPAuthenticate unless you have included a meta tag


pointing to the type
quote:

>library
>
><!--METADATA TYPE="TypeLib" UUID="CD000000-8B95-11D1-


82DB-00C04FB1625D"
quote:

>NAME="CDOSYS"-->
>
>Alternatively you can use the literal constants - the


values are available
quote:

>in the SDK include files
>
>
>"Glenn" <anonymous@discussions.microsoft.com> wrote in


message
quote:

>news:0a9401c3c0b8$08314cf0$a301280a@phx.gbl...
cdoSendUsingPort[QUOTE][color=darkred]
= "mail.somewhere.org"[QUOTE][color=darkred]
for[QUOTE][color=darkred]
>
>
>.
>


Alex Feinman [MVP]

2004-01-24, 2:04 am

Same thing, you need to look up the actual values for those constants in the
SDK as VBScript has no idea what cdoSendUsingMethod is.

"Glenn" <anonymous@discussions.microsoft.com> wrote in message
news:14d2501c3c3d5$637f8de0$a601280a@phx
.gbl...[QUOTE][color=darkred]
> This isn't an ASP page.. .... using VB Script actually
> out of CuteFTP Pro .... if I point to the Microsoft site
> for the schema it works fine ....
> cdoSendUsingMethod or
> pointing to the type
> 82DB-00C04FB1625D"
> values are available
> message
> cdoSendUsingPort
> = "mail.somewhere.org"
> for


=?Utf-8?B?R2xlbm4=?=

2004-01-24, 2:05 am

Must be missing something here .. OR getting to close to the New Tear .. I have this

<!-- METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" -->
Dim Flds
Dim iConf

Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
' .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
' .Item(sch & "smtpserver") = "mail.lmhXXXXX.org"
.Item("sendusing") = 1 ' cdoSendUsingPort
.Item("smtpserver") = "mail.lmhXXXXXX.org"
.update
End With

Set cdoMessage = CreateObject("CDO.Message")


With cdoMessage
Set .Configuration = cdoConfig
.From = "from@me.com"
.To = "GRonken@lmhXXXXX.org"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing


=?Utf-8?B?R2xlbm4=?=

2004-01-24, 2:05 am

Guess I am missing something here .. I downloaded the SDK and it installed

I am to use this?

<!-- METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" -->
Dim Flds
Dim iConf

Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

' sch = "http://schemas.microsoft.com/cdo/configuration/"

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
' .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
' .Item(sch & "smtpserver") = "mail.lmhXXXXX.org"
.Item("sendusing") = 1 ' cdoSendUsingPort
.Item("smtpserver") = "mail.lmhXXXXXX.org"
.update
End With

Set cdoMessage = CreateObject("CDO.Message")


With cdoMessage
Set .Configuration = cdoConfig
.From = "from@me.com"
.To = "GRonken@lmhXXXXX.org"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com