Skip to content

Instantly share code, notes, and snippets.

@FleXoft
Created July 27, 2021 12:29
Embed
What would you like to do?
PowerShell SMTP sender
$emailSmtpServer = "smtp.xxxx.hu"
$emailSmtpServerPort = "25"
$emailSmtpUser = ""
$emailSmtpPass = ""
$emailFrom = "HpOneTouch-Teszt@xxxx.hu"
$emailTo = "gyorgy.fleischmann@fnxs.hu"
$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