From 48b26ed6db2d0b5c1548ba835a910fccee18ed9e Mon Sep 17 00:00:00 2001 From: Rouzax Date: Thu, 24 Aug 2023 15:34:44 +0200 Subject: [PATCH] No mail if label is NoMail --- functions/Stop-Script.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/Stop-Script.ps1 b/functions/Stop-Script.ps1 index dd41b0e..06617c9 100644 --- a/functions/Stop-Script.ps1 +++ b/functions/Stop-Script.ps1 @@ -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