SMTP .net object demo from my TechEd 2007 PowerShell session

Wolfgang requested a reprint of the details from the "SMTP Demo" part of my TechEd talk last week. Here is (roughly) the transcript of the steps, and my comments interspersed...

[PS] C:\>$dl = Get-DistributionGroup SomeGroup

Ok, now we've got $dl variableĀ loaded up with a distribution group object.

[PS] C:\>$dladdr = $dl.PrimarySmtpAddress.ToString()
[PS] C:\>$dladdr
SomeGroup@somedomain.com

And we've extracted the SMTP address from this group into the $dladdr variable.

[PS] C:\>$smtpclient = new-object System.Net.Mail.SmtpClient E12Server1, 587
[PS] C:\>$smtpclient

Host : E12Server1
Port : 587
UseDefaultCredentials : False
Credentials :
Timeout : 100000
ServicePoint : System.Net.ServicePoint
DeliveryMethod : Network
PickupDirectoryLocation :
EnableSsl : False
ClientCertificates : {}

Created a DotNet object (thanks PowerShell!!) of System.Net.Mail.SmtpClient type. This sort of usability is a big part of why PowerShell is so wicked cool!

[PS] C:\>$cred = get-credential domain\exadmin
[PS] C:\>$cred

UserName Password
-------- --------
e12dom\exadmin System.Security.SecureString

[PS] C:\>$smtpclient.Credentials = $cred.GetNetworkCredential()

Save off a credential variable we can use in a moment (we'll need to authenticate to the connector since it's configured for basic auth and no anonymous relay).

[PS] C:\>$smtpclient.Send("exadmin@somedomain.com", $dladdr, "Welcome", "New list created.")

And... voila! Email is sent!

Now, challenge for the reader -- can you take these steps and build out a "mail-storm" script? I'd love to see your results on this idea posted here in the comments or at https://www.exchangeninjas.com/ wiki! Or any other cool variations or uses for this sort of functionality that you can come up with.