In my previous scripts I’ve included a function to send log files to an on-premises Exchange server. I’ve now put together an example script to improve this function to send emails to external e-mail providers, for example: Office 365, Outlook.com or GMail.com. This new code is designed to support many different requirements: No logging at all. Logging but with no e-mail. Logging with e-mail. E-mail with username & password authentication, with SSL.
I needed to write a PowerShell utility to create Exchange mailboxes for new users in Active Directory. The utility needed to create the mailboxes, use different databases, retention policies, and take users from several Organisational Units along with users in child OUs. This utility is available to download from the Microsoft TechNet Gallery, PowerShell Gallery and GitHub. If you’d like to contact me, please leave a comment, send me a tweet or DM, or you can join my Discord server.