MemberType : Method
OverloadDefinitions : {void Send ()}
TypeNameOfValue : System.Management.Automation.PSMethod
Value : void Send ()
Name : Send
IsInstance : True
that's all it says... it doesn't actually send an email.
"RichS" wrote:
> What actually happens when you run the code? Do you get an error message?
> --
> Richard Siddaway
> Please note that all scripts are supplied "as is" and with no warranty
> Blog: http://richardsiddaway.spaces.live.com/
> PowerShell User Group: http://www.get-psuguk.org.uk
>
>
> "Peter" wrote:
>
> > Hi Everyone,
> >
> > What's wrong wtih my code? I ported this from my VBScript.
> >
> > $msg = new-Object -comobject "CDO.Message";
> >
> > $msg.From = "m...@email.com";
> > $msg.To = "m...@email.com";
> > $msg.Subject = "This is a test subject.";
> > $msg.TextBody = "This is a test body.";
> >
> > $msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ;
> > $msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.server.com";
> > $msg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ;
> > $msg.Send;
> >
> > I'm a long-time VBScript coder since I am a Windows Administrator at a bank.
> > Since Powershell came out, I've been doing my darndest to learn it as well
> > as VBScript, but this last one has me pulling my hair out.
> >
> > By the way, I love the string-parsing capabilities of Powershell. AWESOME!
"Peter" <Pe...@discussions.microsoft.com> wrote in message
news:5A0BA9FF-6B85-4711...@microsoft.com...
When you call a method like you have add the ().
p.s. You dont need ; at the end of every line if its a script. You only need
that if your gonna make multiple commands on one line. Here is example where
its needed
-- Code --
Write-Host "Hello" ; Write-Host "There"
-- Code --
You could also do this
-- Code --
Write-Host "Hello"
Write-Host "There"
-- Code --
"Peter" <Pe...@discussions.microsoft.com> wrote in message
news:5A0BA9FF-6B85-4711...@microsoft.com...
Thanks for writing back. I tried it with '.Send()' and '.Send ()'. Neither
is working. Try running the code yourself at home, you'll see what I'm
talking about. Thanks.
Peter