Last active
August 29, 2015 14:07
-
-
Save najamsk/65c8c432e3c3ce42f2ae to your computer and use it in GitHub Desktop.
send emails with powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$EmailFrom = "from@mail.com" | |
$EmailTo = "to@mail.com" | |
$Subject = "emailing powershell report" | |
$Body = "this should work on remove server as well. test email" | |
$SMTPServer = "smtp.gmail.com" | |
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) | |
$SMTPClient.EnableSsl = $true | |
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("gmailUser", "gmailPasswor"); | |
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment