Skip to content

Instantly share code, notes, and snippets.

@raulunzue
Created August 24, 2020 20:35
Show Gist options
  • Save raulunzue/c04a43d9b76874238b877d6bdbec5aa8 to your computer and use it in GitHub Desktop.
Save raulunzue/c04a43d9b76874238b877d6bdbec5aa8 to your computer and use it in GitHub Desktop.
envio-correos-tls.ps1
$emailSmtpServer = "smtp.elblogdenegu.com"
$emailSmtpServerPort = "587"
$emailSmtpUser = "maquinasvirtuales@elblogdenegu.com"
$emailSmtpPass = "xxxxxx"
$emailFrom = "maquinasvirtuales@elblogdenegu.com"
$emailTo = "prueba01@maquinasvirtuales.eu"
$emailcc="prueba02@maquinasvirtuales.eu"
$emailMessage = New-Object System.Net.Mail.MailMessage($emailFrom , $emailTo )
$emailMessage.cc.add($emailcc)
$emailMessage.Subject = "TEST"
#$emailMessage.IsBodyHtml = $true #true or false depends
$emailMessage.Body = "Envio de TEST desde Powershell"
$SMTPClient = New-Object System.Net.Mail.SmtpClient($emailSmtpServer , $emailSmtpServerPort )
$SMTPClient.EnableSsl = $False
$SMTPClient.Credentials = New-ObjectSystem.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