Skip to content

Instantly share code, notes, and snippets.

@marckean
Created May 15, 2017 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marckean/95edfc8f9d0388c397e01e6ce14529ad to your computer and use it in GitHub Desktop.
Save marckean/95edfc8f9d0388c397e01e6ce14529ad to your computer and use it in GitHub Desktop.
$MyService = @()
$EmailFrom = @()
$Subject = @()
$Body = @()
$computer = @()
$computer = gc env:computername
$SMTPServer = "smtp.sendgrid.net"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $false
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("<USERNAME>", "<PASSWORD>");
$EmailFrom = "$computer@domain.com.au"
$EmailTo = "someone@domain.com"
$Subject = "Job Name: $JOBNAME, $RESULT, Errors: $ERRORS, Synced: $SYNCOK"
$Body = "$ALLARGS"
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment