Skip to content

Commit 3219a98

Browse files
allow disabling of email
1 parent 983485b commit 3219a98

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Standards/Push-CIPPDriftManagement.ps1

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ function Push-CippDriftManagement {
3636

3737
$GenerateEmail = New-CIPPAlertTemplate -format 'html' -data $Data -CIPPURL $CIPPURL -Tenant $Item.Tenant -InputObject 'driftStandard' -AuditLogLink $drift.standardId
3838

39-
# Send email alert if configured
40-
$CIPPAlert = @{
41-
Type = 'email'
42-
Title = $GenerateEmail.title
43-
HTMLContent = $GenerateEmail.htmlcontent
44-
TenantFilter = $Item.Tenant
39+
# Send email alert if configured and not disabled
40+
if (-not $Settings.driftAlertDisableEmail) {
41+
$CIPPAlert = @{
42+
Type = 'email'
43+
Title = $GenerateEmail.title
44+
HTMLContent = $GenerateEmail.htmlcontent
45+
TenantFilter = $Item.Tenant
46+
}
47+
Write-Information "Sending email alert for tenant $($Item.Tenant)"
48+
Send-CIPPAlert @CIPPAlert -altEmail $email
49+
} else {
50+
Write-Information "Email alert disabled for tenant $($Item.Tenant)"
4551
}
46-
Write-Information "Sending email alert for tenant $($Item.Tenant)"
47-
Send-CIPPAlert @CIPPAlert -altEmail $email
4852
# Send webhook alert if configured
4953
$WebhookData = @{
5054
Title = $GenerateEmail.title

Modules/CIPPCore/Public/Functions/Get-CIPPTenantAlignment.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ function Get-CIPPTenantAlignment {
317317
standardSettings = $Template.Standards
318318
driftAlertEmail = $Template.driftAlertEmail
319319
driftAlertWebhook = $Template.driftAlertWebhook
320+
driftAlertDisableEmail = $Template.driftAlertDisableEmail
320321
AlignmentScore = $AlignmentPercentage
321322
LicenseMissingPercentage = $LicenseMissingPercentage
322323
CombinedScore = $AlignmentPercentage + $LicenseMissingPercentage

0 commit comments

Comments
 (0)