Created
October 14, 2019 18:52
-
-
Save jcefoli/9d3392271620c4bfb3e58d8b353ea3f0 to your computer and use it in GitHub Desktop.
Send Email in Powershell via .NET Net.Mail.SmtpClient & Net.Mail.MailMessage
This file contains hidden or 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
$message = new-object Net.Mail.MailMessage; | |
$message.From = "[email protected]"; | |
$message.To.Add('[email protected]'); | |
$message.Subject = "Test by Joe"; | |
$message.Body = "Message body here"; | |
$smtp = new-object Net.Mail.SmtpClient("smtp.server.local", "25"); | |
$smtp.send($message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment