Friday, August 9, 2013

Use PowerShell to send test email in batches or on schedules

Recently, I had to test a scenario where an ActiveSync device received a relatively large (70-100) batch of emails in a relatively short (60-90s) window.

For smaller tests of this type, I've set Outlook into Offline mode, created 5-10 draft emails, sent them all, then switched back to Online mode to have them send at the same time. In this case, I wasn't interested in copypasta'ing 70 to 100 times per test, so I did some quick research, and found that Exchange 2010 has a Send-MailMessage cmdlet that ... well ... sends a mail message...

Anyhoo, a bit of Google-fu led me to this ASP.Net forum post. I ran the HTML code in the final reply through a parser, and found a script that pointed me to JFRMilner's Tech Blog. I saw an opportunity to expand that script and add some functionality, and some intense PowerShell scripting later, I had a finished product. You can check it out on Gist.

No comments:

Post a Comment