msdn subscription is a good source of finding various classes and
constructors.
That is why i m now trying to move from vbscript to powershell.
But at time, i still wonder whether i shld create small programs in pure
..net environment (eg vs2005), this is where i m struggling now ...
"Fred J." <swim.instructor@gmail.com> wrote in message
news:1161356541.004369.26930@i3g2000cwc.googlegroups.com...
> mabster,
> Yes this does help. Too me the mystery was unmasking the public
> constructors in the send method. Now i see they are derived from .NET
> Framework Class Library
> MailMessage Constructor (String, String, String, String). I am new to
> the Net Framework but I finally found the overload list here
> http://msdn2.microsoft.com/en-us/lib...ilmessage.aspx
> and the declaration here
> http://msdn2.microsoft.com/en-us/library/5k0ddab0.aspx
>
> Is this the way to 'dope-out' everything in .Net?
>
> Now I am going to try to add an attachment.
>
> Fred J.
>
>
>
> mabster wrote:
>> No worries, Fred.
>>
>> The first step is creating an instance of SmptClient, and passing in a
>> mail server name to its constructor. In C# that'd look like this:
>>
>> System.Net.Mail.SmtpClient sc = new
>> System.Net.Mail.SmtpClient("mailserver.example.com")
>>
>> ... but in PS it's:
>>
>> new-object Net.Mail.SmtpClient -arg "mailserver.example.com"
>>
>> (The -arg parameter of new-object is how we pass stuff into an object's
>> constructor.)
>>
>> So once we have our object, we just want to call its Send method. In C#
>> we'd do this:
>>
>> sc.Send("from@powershell.com", "to@example.com", "Subject", "Here is
>> some mail from PowerShell.");
>>
>> ... but in PS we don't even need a variable - we can just use the
>> instance inline by wrapping it in parentheses, like this:
>>
>> (new-object Net.Mail.SmtpClient -arg
>> "mailserver.example.com").Send("from@powershell.com", "to@example.com",
>> "Subject", "Here is some mail from PowerShell.")
>>
>> Note that I could have done it on two lines with a variable:
>>
>> $sc = new-object Net.Mail.SmtpClient -arg "mailserver.example.com"
>> $sc.Send("from@powershell.com", "to@example.com", "Subject", "Here is
>> some mail from PowerShell.");
>>
>> Does that help?
>>
>> Fred J. wrote:
>> > Matt,
>> > I found the .NET Framework Class Library references in the MSDN library
>> > for SmtpClient Class and SmtpClient.Send Method (MailMessage) .
>> > However, can you give me some hints on how you transform that
>> > documentation into the example you showed? Or is there another class
>> > that i missed?
>> >
>> > Thank you,
>> > Fred Jacobowitz
>> >
>> > Matt Hamilton wrote:
>> >> That seems a bit excessive. How about:
>> >>
>> >> (new-object Net.Mail.SmtpClient -arg
>> >> "mailserver.example.com").Send("from@powershell.com",
>> >> "to@example.com",
>> >> "Subject", "Here is some mail from PowerShell.")
>> >
>