![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #11 (permalink) |
| | Re: Sending eMails Jim Holbach wrote: > PS> $a.MSDN() > > will open a separate browser window in the msdn2.microsoft.com site with the > documentation for the class of the object. In this example, it opened > "http://msdn2.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx". Eh? Is this something you've set up for yourself, Jim? There's no "MSDN" function in my shell: Method invocation failed because [System.Net.Mail.SmtpClient] doesn't contain a method named 'MSDN'. At line:1 char:8 + $a.MSDN( <<<< ) |
My System Specs![]() |
| | #12 (permalink) |
| | Re: Sending eMails Sorry. I've gotten so used to using this method, I forgot it was a type extension that Jeffrey Snover posted at http://blogs.msdn.com/powershell/arc...24/644987.aspx. "Matt Hamilton" wrote: > Jim Holbach wrote: > > > PS> $a.MSDN() > > > > will open a separate browser window in the msdn2.microsoft.com site with the > > documentation for the class of the object. In this example, it opened > > "http://msdn2.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx". > > Eh? Is this something you've set up for yourself, Jim? There's no "MSDN" > function in my shell: > > Method invocation failed because [System.Net.Mail.SmtpClient] doesn't > contain a method named 'MSDN'. > At line:1 char:8 > + $a.MSDN( <<<< ) > |
My System Specs![]() |
| | #13 (permalink) |
| | Re: Sending eMails Here's the code... # First, I instantiate the SmtpClient object... $Mailer = new-object Net.Mail.SmtpClient("mail.server.it") # Then, I instantiate a new MailMessage object, with sender, destination, subject and body $Message = new-object Net.Mail.MailMessage("f.grande@poker.it", "f.grande@poker.it", "Subject", "Here is some mail from PowerShell.") # I create a new Attachment object $Attach = new-object Net.Mail.Attachment("c:\\bell.ico") # I attach the attachment to the message $Message.Attachments.Add($Attach) # Send them all... $Mailer.Send($Message) Hope it helps... Bye |
My System Specs![]() |
| | #14 (permalink) |
| | Re: Sending eMails Hi mabster, just a question... new-object Net.Mail.SmtpClient -arg "mailserver.example.com" is the same of new-object Net.Mail.SmtpClient("mailserver.example.com") ?!?!?!?!?! TIA FabioG |
My System Specs![]() |
| | #15 (permalink) |
| | Re: Sending eMails Fabio GRANDE poker.it> <f.grande wrote: > Hi mabster, just a question... > > new-object Net.Mail.SmtpClient -arg "mailserver.example.com" > > is the same of > > new-object Net.Mail.SmtpClient("mailserver.example.com") Does that work? (tries) Yeah, it does. How 'bout that? Yeah, that's the same thing then, Fabio. Not sure why both syntaxes are supported. The former feels a bit more "PowerShelly" if you know what I mean. |
My System Specs![]() |
| | #16 (permalink) |
| | Re: Sending eMails "mabster" <mabster@madprops.nospam.org> wrote in message news:%23mYs5dn9GHA.2364@TK2MSFTNGP02.phx.gbl... > Fabio GRANDE poker.it> <f.grande wrote: >> Hi mabster, just a question... >> >> new-object Net.Mail.SmtpClient -arg "mailserver.example.com" >> >> is the same of new-object Net.Mail.SmtpClient("mailserver.example.com") > > Does that work? (tries) Yeah, it does. How 'bout that? > > Yeah, that's the same thing then, Fabio. Not sure why both syntaxes are > supported. The former feels a bit more "PowerShelly" if you know what I > mean. Those are actually the same form; you're just seeing PowerShell treating argument separation intelligently (but obscurely). The second example is really see as: new-object Net.Mail.SmtpClient ("mailserver.example.com") Here's a quick demonstration to prove it: PS> function test{param($one,$two);write-host $one; write-host $two;} PS> test 1(2) 1 2 Note that classes such as this with simple constructors can be instantiated even more easily: [Net.Mail.SmtpClient]"mailserver.example.com" |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| SENDING EMAILS | Vista mail | |||
| Re: sending emails | Vista mail | |||
| sending emails | Vista mail | |||
| sending emails | Vista mail | |||
| Sending emails | Vista mail | |||