Skip to content

Instantly share code, notes, and snippets.

@fcenobi
Forked from jpoehls/smtp-test.ps1
Created July 21, 2019 17:50
Show Gist options
  • Save fcenobi/4811f1d7bfde97cbce4295373803863f to your computer and use it in GitHub Desktop.
Save fcenobi/4811f1d7bfde97cbce4295373803863f to your computer and use it in GitHub Desktop.
SMTP Test Script (in PowerShell)
$smtp = New-Object System.Net.Mail.SmtpClient
$smtp.Host = "127.0.0.1"
$smtp.Port = 587
$creds = New-Object System.Net.NetworkCredential
# $currentCreds = Get-Credential
$creds.Domain = ""
$creds.UserName = "my_user" # $currentCreds.UserName
$creds.Password = "my_pass" # $currentCreds.GetNetworkCredential()
$smtp.Credentials = $creds
$smtp.Send("sender@domain.com", "receipient@domain.com", "My Subject", "My Message")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment