Page 1 of 1

Sending notifications to Exchange Servers (NTLM)

Posted: Wed Sep 11, 2019 7:46 pm
by ForumAdmin
An example of sending an email notification post upload in the user's "scripts/commands" - "post upload command' field.

call with:

powershell.exe -file c:\path\sendmail.ps1 "%1"

sendmail.ps1

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { return $true }
$EmailFrom = "you@youremail.com"
$EmailTo = "to@otherdomain.com"
$Subject = "Upload completed"
$Body = $args[0]
$SMTPServer = "mail.youremailserver.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("yourdomain\youraccount", "yourpassword");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)



You may need to set the following command in powershell manually:

Set-ExecutionPolicy unrestricted