Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Tue, 13 May 2008 20:23:24 +0400,    group: microsoft.public.exchange.admin        back       


Sending Mail from powershell   
Hello,
I need to send mail to users from powershell,
I try to:

$SMTPserver = "hub01.corp.net"
$from = "admin@corp.net"
$to = "user01@corp.main.net"
$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@corp.main.net" ($_.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.
date: Tue, 13 May 2008 20:23:24 +0400   author:   Arman Obosyan am

Re: Sending Mail from powershell   
import-csv

What Can I Do With Windows PowerShell?
http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/import-csv.mspx

Import-CSV "c:\myfile.csv" | foreach {code-block here, use $_.FieldName for 
fields from your csv}

example:
 Exchange Server 2007: Bulk creation of mailboxes using Exchange Management 
Shell
http://exchangepedia.com/blog/2006/11/exchange-server-2007-bulk-creation-of.html
-- 
Bharat Suneja
Microsoft Corporation
blog: exchangepedia.com/blog

This posting is provided "AS IS" with no warranties, and confers no
rights. Please do not send email directly to this alias. This alias is for
newsgroup purposes only.
----------------------------

"Arman Obosyan" <armarn@community.nospam> wrote in message 
news:37CBA124-2CD9-4A7F-90AC-EA418DEC7D49@microsoft.com...
> Hello,
> I need to send mail to users from powershell,
> I try to:
>
> $SMTPserver = "hub01.corp.net"
> $from = "admin@corp.net"
> $to = "user01@corp.main.net"
> $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@corp.main.net" ($_.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.
>
>
>
>
date: Tue, 13 May 2008 09:45:39 -0700   author:   Bharat Suneja [MSFT]

Re: Sending Mail from powershell   
Thanks!


Arman Obosyan.


"Bharat Suneja [MSFT]"  wrote in message 
news:ussRHjRtIHA.1768@TK2MSFTNGP03.phx.gbl...
> import-csv
>
> What Can I Do With Windows PowerShell?
> http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/import-csv.mspx
>
> Import-CSV "c:\myfile.csv" | foreach {code-block here, use $_.FieldName 
> for fields from your csv}
>
> example:
> Exchange Server 2007: Bulk creation of mailboxes using Exchange Management 
> Shell
> http://exchangepedia.com/blog/2006/11/exchange-server-2007-bulk-creation-of.html
> -- 
> Bharat Suneja
> Microsoft Corporation
> blog: exchangepedia.com/blog
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights. Please do not send email directly to this alias. This alias is for
> newsgroup purposes only.
> ----------------------------
>
> "Arman Obosyan" <armarn@community.nospam> wrote in message 
> news:37CBA124-2CD9-4A7F-90AC-EA418DEC7D49@microsoft.com...
>> Hello,
>> I need to send mail to users from powershell,
>> I try to:
>>
>> $SMTPserver = "hub01.corp.net"
>> $from = "admin@corp.net"
>> $to = "user01@corp.main.net"
>> $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@corp.main.net" ($_.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.
>>
>>
>>
>>
>
date: Thu, 15 May 2008 17:25:39 +0400   author:   Arman Obosyan am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us