Created
July 27, 2021 12:29
-
-
Save FleXoft/13e66144fb40524111a3c949413b5836 to your computer and use it in GitHub Desktop.
PowerShell SMTP sender
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
$emailSmtpServer = "smtp.xxxx.hu" | |
$emailSmtpServerPort = "25" | |
$emailSmtpUser = "" | |
$emailSmtpPass = "" | |
$emailFrom = "[email protected]" | |
$emailTo = "[email protected]" | |
$emailcc="CC" | |
$emailMessage = New-Object System.Net.Mail.MailMessage( $emailFrom , $emailTo ) | |
#$emailMessage.cc.add($emailcc) | |
$emailMessage.Subject = "subject" | |
#$emailMessage.IsBodyHtml = $true #true or false depends | |
$emailMessage.Body = "body" | |
$SMTPClient = New-Object System.Net.Mail.SmtpClient( $emailSmtpServer , $emailSmtpServerPort ) | |
# $SMTPClient.EnableSsl = $true | |
# $SMTPClient.Credentials = New-Object System.Net.NetworkCredential( $emailSmtpUser , $emailSmtpPass ); | |
$SMTPClient.Send( $emailMessage ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment