when relevant content is
added and updated.
The other day I was out reading some blog posts and I ran across one that talked about needing to send an email to a ridiculous number of people. So many that they could not all be fit into the to and cc fields of Outlook. So I thought why not Powershell this. All you would need is a listing of the email addresses that you want to send the mail to and then a file that contains the body of the email. For the addresses I would hope that you have them in your contacts and then you can do an export to a file. Once you have that then type the body of the email into a file and now lets write a script to send it.
$users = get-content “path to file with listing of email addresses”
foreach ($user in $users)
$smtpServer = “name of smtp server to send mail”
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$emailFrom = “firstname.lastname@example.org”
$subject = “Some Subject Line”
foreach ($line in Get-Content “Path to file with body of email”)
$body += “$line `n”
So there you go. No limit on how many users this script will send the mail to. Any questions or comments please let me know and also goto sysadminsmith.com to drop me an email.