![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Sending Mail from powershell Hello, I need to send mail to users from powershell, I try to: $SMTPserver = "hub01.corp.net" $from = "admin@xxxxxx" $to = "user01@xxxxxx" $subject = "Inform You...." $emailbody = "Service unavailable from 10pm to 11pm..." $mailer = New-Object Net.Mail.SMTPclient($SMTPserver) $msg = New-Object Net.Mail.MailMessage($from, $to, $subject, $emailbody) $mailer.send($msg) But how can I specify parameters and get data from CSV file for mass mailing e.g. $to = "user01@xxxxxx" ($_.usersfromcsvfile??? ) $emailbody = "Service unavailable from 10pm to 11pm..." ($_.mailbodyfromcsvfile??? ) What exactly I need to modify in this ps script to get data from Import-CSV ? Thank you. Arman. |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Sending Mail from powershell Arman Obosyan wrote:
PSH>gc test.csv users joe foo bar PSH>import-csv test.csv|%{$emails+=$_.users+","} PSH>$emails.trimend(",") joe,foo,bar So maybe the above and: PSH>$trimmed=$emails.trimend(",") PSH>$to = "user01@xxxxxx"+"$trimmed" Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com | ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | Re: Sending Mail from powershell Nice, Thank you! Arman Obosyan. "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message news:#Q3EHrRtIHA.1772@xxxxxx
| ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SENDING E-MAIL FROM WINDOWS MAIL CONTACT ADDRESS BOOK | pedidocsbp | Vista mail | 3 | 05-14-2008 03:25 AM |
| Re: Suffering from sending mail from Windows Mail?? Your prayers a | River Ron | Vista mail | 1 | 04-01-2008 10:48 PM |
| Error sending E-mail with Windows Vista and Windoes Mail | grburris | Vista mail | 8 | 03-14-2008 04:54 PM |
| slow performance creating and sending e-mail with windows mail | Dlawyers | Vista mail | 5 | 08-05-2007 03:31 AM |
| Fixed Windows Mail Outbox Stuck Message & E-mail Not Sending | Trick | Vista mail | 11 | 03-17-2007 01:30 PM |