RE: Using VBScript to send message using CDO.message



Ok, so now what? I found this code snippet, which is similar to Vlad's idea,
and now I get this error:

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

Note I've tried subbing 2 for cdoSendUsingPort as Vlad suggests, but no go.

This is not working from my XP machine. I haven't even tried it on my
server yet.

Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "server.mycompany.com"
.Update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.From = "from@xxxxxx"
.To = "to@xxxxxx"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing




"JMS" wrote:

> Ok, I don't get this. I used the stock script from the Script Center
> repository for sending a message on my PC and it works. I use it on a
> Windows 2003 server and it won't. I'm getting this message:
>
> CDO.Message.1: The "SendUsing" configuration value is invalid.
>
> What's this mean? I thought it was because Outlook wasn't installed on the
> server. Well, a full-blown install is now there and I STILL get this problem.
>
> The code is just this easy and nothing but the Script Center website sample:
>
> Dim objEmail
>
> Set objEmail = CreateObject("CDO.Message")
> objEmail.From = "server@xxxxxxxxxxxxx"
> objEmail.To = "jms@xxxxxxxxxxxxx"
> objEmail.Subject = "Something didn't work!"
> objEmail.Textbody = "The import at " & now & " failed."
> objEmail.Send
>
> Set objEmail = Nothing
>
.



Relevant Pages

  • RE: Installing Software from a network share
    ... Just have a look at this code snippet: ... This script returns the MP and assigned site. ... > determine the local server. ... > specific software shares on our SMS servers in remote ...
    (microsoft.public.sms.swdist)
  • Interview questions on .Net 3.0
    ... You can get the atlas Ajax setup ... when we request any website. ... When client sends data to the server it post backs form element data, ... Below is a code snippet which shows how to use XMLHttpRequest object. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Impersonating doesnt work on Win2003
    ... Here's the code snippet I used to do it. ... on by a terminal server, remote shell, or similar process. ... This logon ... does not cache credentials for this logon type. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Visual Basic and JavaScript
    ... Response is server-side object and judging from the code snippet you place ... it in client script blocks. ... > decided to do a small portion of my DW app in VB, ...
    (microsoft.public.vsnet.general)
  • RE: Streaming javascript and XP Service Pack 2
    ... Thanks for your posting. ... tests based on your description and the code snippet you provided. ... it seems that the script can run correctly on my side. ... #Scripts may not run on a local HTML Web page that references .htc or .xml ...
    (microsoft.public.dotnet.framework.aspnet)

Loading