Lately I’ve been setting up a back-end script for one of our customers.
The full script creates Domain users and adds them to domain groups, generates passwords and emails the manager/CEO the user information.

This post will only contain the Email function, more functions will be posted later.

Function SendMail{
     #SMTP server name
     $SMTPServer = "" #Change this: Your SMTP server

     #Creating a Mail object
     $Msg = new-object Net.Mail.MailMessage

     #Creating SMTP server object
     $SMTP = new-object Net.Mail.SMTPClient($SMTPServer)

     #Email structure 
     $Msg.From = ""
     $Msg.ReplyTo = ""
     $Msg.subject = "Powershell is king!"
     $Msg.body = "Hi," + "`r`n" + `
                 "I'm a visitor!"

     #Sending email 

Now please don’t use this to spam people, it’s a bad idea! :)

Let me know if you need help, and please share this post!