PS H:\> &"C:\Documents and Settings\bla\Desktop\Email.ps1"
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 = "me@email.com";
> > $msg.To = "me@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!