Skip to content

Commit

Permalink
No mail if label is NoMail
Browse files Browse the repository at this point in the history
  • Loading branch information
Rouzax committed Aug 24, 2023
1 parent f67cf8e commit 48b26ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion functions/Stop-Script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ function Stop-Script {

Format-Table
Write-Log -LogFile $LogFilePath
Send-Mail -SMTPserver $SMTPserver -SMTPport $SMTPport -MailTo $MailTo -MailFrom $MailFrom -MailFromName $MailFromName -MailSubject $ExitReason -MailBody $LogFilePath -SMTPuser $SMTPuser -SMTPpass $SMTPpass
# Handle Empty Download Label
if ($DownloadLabel -ne 'NoMail') {
Send-Mail -SMTPserver $SMTPserver -SMTPport $SMTPport -MailTo $MailTo -MailFrom $MailFrom -MailFromName $MailFromName -MailSubject $ExitReason -MailBody $LogFilePath -SMTPuser $SMTPuser -SMTPpass $SMTPpass
}

# Clean up the Mutex
Remove-Mutex -MutexObject $ScriptMutex
Expand Down

0 comments on commit 48b26ed

Please sign in to comment.