|
|
|
| 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 ......
>
| |
|
| 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 orquote:
>cdoSMTPAuthenticate unless you have included a meta tag
pointing to the typequote:
>library
>
><!--METADATA TYPE="TypeLib" UUID="CD000000-8B95-11D1-
82DB-00C04FB1625D"quote:
>NAME="CDOSYS"-->
>
>Alternatively you can use the literal constants - the
values are availablequote:
>in the SDK include files
>
>
>"Glenn" <anonymous@discussions.microsoft.com> wrote in
messagequote:
>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
|
|
|
|