01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
# Credentials section
$emailFrom = "yomama@kungfustudio.com"
$password = "eatYourSalad!" | ConvertTo-SecureString -AsPlainText -Force # plaintext password
#$EncryptedPasswordFile='c:\scripts\encryptedPasswordFile'
#$password = Get-Content -Path $EncryptedPasswordFile | ConvertTo-SecureString
 
# Contents section
$emailTo = "panda@kungfustudio.com"
$emailMessage = New-Object System.Net.Mail.MailMessage( $emailFrom , $emailTo )
#$emailcc="mantis@kungfustudio.com"
#$emailMessage.cc.add($emailcc)
$emailMessage.Subject = "test email"
$emailMessage.IsBodyHtml = $true
$emailMessage.Body = "test email please delete"
 
# Sendmail action
$smtpServer = "smtp.office365.com"
$port = "587"
$smtpClient = New-Object System.Net.Mail.SmtpClient( $smtpServer , $port )
$smtpClient.EnableSsl = $True
$smtpClient.Credentials = New-Object System.Net.NetworkCredential( $emailFrom , $password );
$smtpClient.Send( $emailMessage )