Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Microsoft automatically blocks images on all external emails and there is no admin level configuration that ensures images are automatically shown to end-users unless it’s on their personal safe list. User could manually add the domains to their own safe list but that is cumbersome and not something we’d expect a user to perform.

...

To optionally add all domains to all of your users allow list you can run the following script using the Exchange Online V3 PowerShell modules.

...

Code Block
breakoutModewide
languagepowershell
<#
YOU MUST CONNECT to Exchange Online as a Global Admin for this script to run properly. 
Connect-ExchangeOnline
#>

$domains = @(
    "ssuport.com",
    "supppot.com",
    "center-supports.com",
    "supoorts.com",
    "suporrt.com",
    "team-support.net",
    "supppot.net",
    "legal-user.com",
    "the-verification.com",
    "legals-team.com",
    "authenticatecenter.com",
    "ourlogin.co.uk",
    "mnminfo.com",
    "help-desc.com",
    "account-protector.com",
    "calendarsupdates.com",
    "appstatusupdate.com",
    "hr-updates.net",
    "itservicesector.com",
    "mailer-sender.com",
    "servicealerts.net",
    "status-pager.com",
    "nonreplies.com",
    "registerconfirmation.com",
    "altasian.net",
    "communitlyforums.com",
    "validation-service.net",
    "supplyservice.net",
    "shopping-card.net",
    "paymentserrvice.com",
    "online-store-service.com",
    "market-sales.net",
    "internal-service-updates.com",
    "infraupdates.com"
)

# Prompt user to choose between adding or removing domains

$addDomains = ""
while ($addDomains -ne "a" -and $addDomains -ne "r") {
    $addDomains = Read-Host "Do you want to add (a) or remove (r) domains? (Aa/Rr)"
    $addDomains = $addDomains.Trim().ToLower()  # Trim whitespace and convert to lowercase
}

function Write-ProgressHelper {
    param (
        [int]$StepNumber,
        [string]$Message
    )

    Write-Progress -Activity 'Updating SafeList' -Status $Message -PercentComplete (($StepNumber / $steps) * 100)
}
$script:steps = ([System.Management.Automation.PsParser]::Tokenize((Get-Content "$PSScriptRoot\$($MyInvocation.MyCommand.Name)"), [ref]$null) | Where-Object { $_.Type -eq 'Command' -and $_.Content -eq 'Write-ProgressHelper' }).Count

$stepCounter = 0

# Get all active user type mailboxes
Write-ProgressHelper -Message 'Getting mailboxes' -StepNumber ($stepCounter++)
$Mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited
$totalMailboxes = $Mailboxes.Count
Write-Output "Total mailboxes: $totalMailboxes"
$processedMailboxes = 0

# Configure junk email settings for each mailbox
if ($addDomains -eq "A" -or $addDomains -eq "a") {
    $JunkEmailConfig = @{
        Add = "ssuport.com", "supppot.com", "center-supports.com", "supoorts.com", "suporrt.com", "team-support.net", "supppot.net", "legal-user.com", "the-verification.com", "legals-team.com", "authenticatecenter.com", "ourlogin.co.uk", "mnminfo.com", "help-desc.com"
    $domains
    }
} else {
    $JunkEmailConfig = @{
        Remove = "ssuport.com", "supppot.com", "center-supports.com", "supoorts.com", "suporrt.com", "team-support.net", "supppot.net", "legal-user.com", "the-verification.com", "legals-team.com", "authenticatecenter.com", "ourlogin.co.uk", "mnminfo.com", "help-desc.com"
    }
}$domains
    }
}


# Configure junk email settings for each mailbox
Write-ProgressHelper -Message 'Configuring junk email settings' -StepNumber ($stepCounter++)
$i = 0
foreach ($Mailbox in $Mailboxes) {
    $MailboxIdentity = $Mailbox.PrimarySmtpAddress.ToString()
    Set-MailboxJunkEmailConfiguration -Identity $MailboxIdentity -TrustedSendersAndDomains $JunkEmailConfig
    $processedMailboxes++
    if ($addDomains -eq "A" -or $addDomains -eq "a") {

        Write-Progress -Id 1 -Activity "Working..." -status "Added: $i of $($Mailboxes.Count)" -percentComplete (($i / $Mailboxes.Count) * 100)
        $i++
    }
    else {
        Write-Progress -Id 1 -Activity "Working..." -status "Removed: $i of $($Mailboxes.Count)" -percentComplete (($i / $Mailboxes.Count) * 100)
        $i++
    }
}
Write-Output "Processed mailboxes: $processedMailboxes"

...