Skip to content

Instantly share code, notes, and snippets.

@FleXoft
Created July 27, 2021 12:29
Show Gist options
  • Save FleXoft/13e66144fb40524111a3c949413b5836 to your computer and use it in GitHub Desktop.
Save FleXoft/13e66144fb40524111a3c949413b5836 to your computer and use it in GitHub Desktop.
PowerShell SMTP sender
$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