Set-CASMailbox in PowerShell: Turn Off POP, IMAP, OWA, SMTP

3 min read James Futhey First published August 8, 2024
Microsoft Learn documentation for the Set-CASMailbox cmdlet showing its PowerShell syntax

Quick answer

Set-CASMailbox turns email protocols and apps on or off for one mailbox: POP, IMAP, Outlook on the web, Exchange ActiveSync, EWS, MAPI, Outlook mobile and SMTP AUTH. Connect to Exchange Online, then set the parameter to $true or $false:

Connect-ExchangeOnline -UserPrincipalName admin@contoso.com
Set-CASMailbox -Identity kai@contoso.com -PopEnabled $false -ImapEnabled $false
Get-CASMailbox -Identity kai@contoso.com | Format-List PopEnabled,ImapEnabled

Source: Set-CASMailbox on Microsoft Learn. It works in Exchange Online and Exchange Server 2010 to 2019 and Subscription Edition. You need the right permissions first; see Find the permissions required to run any Exchange cmdlet.

What does Set-CASMailbox control?

Each protocol parameter defaults to $true. New mailboxes get ActiveSync, Outlook on the web, MAPI, POP3 and IMAP4 turned on.

Parameter What $false turns off Where
PopEnabled POP3 Online and on-premises
ImapEnabled IMAP4 Online and on-premises
OWAEnabled Outlook on the web and the new Outlook for Windows Online and on-premises
ActiveSyncEnabled Exchange ActiveSync (phone mail apps) Online and on-premises
EwsEnabled Exchange Web Services Online and on-premises
MAPIEnabled MAPI clients such as classic Outlook Online and on-premises
OutlookMobileEnabled Outlook for iOS and Android Exchange Online only
OneWinNativeOutlookEnabled The new Outlook for Windows Exchange Online only
MacOutlookEnabled Outlook for Mac using Microsoft Sync Exchange Online only
UniversalOutlookEnabled Windows 10 Mail and Calendar Exchange Online only
SmtpClientAuthenticationDisabled Authenticated SMTP submission ($true disables it) Exchange Online only

When you set a protocol to $false, Exchange ignores that protocol's other settings for the mailbox.

How do I find the mailbox?

-Identity takes the name, alias, distinguished name, canonical DN, Domain\Username, email address, GUID, LegacyExchangeDN, SamAccountName or user principal name. An email address is the easiest:

Set-CASMailbox -Identity kai@contoso.com -OWAEnabled $false

Examples

Turn off Outlook on the web and POP

Set-CASMailbox -Identity kai@contoso.com -OWAEnabled $false -PopEnabled $false

This also blocks the new Outlook for Windows, and Teams "Share to Outlook" needs Outlook on the web.

Turn off ActiveSync

Set-CASMailbox -Identity kai@contoso.com -ActiveSyncEnabled $false

Turn off Outlook for iOS and Android

Set-CASMailbox -Identity kai@contoso.com -OutlookMobileEnabled $false

Turn off Outlook Anywhere (RPC over HTTP)

Set-CASMailbox -Identity kai@contoso.com -MAPIBlockOutlookRpcHttp $true

Allow or block one ActiveSync device

Get the device ID with Get-MobileDevice, then add or remove it without replacing the whole list:

Get-MobileDevice -Mailbox kai@contoso.com
Set-CASMailbox -Identity kai@contoso.com -ActiveSyncBlockedDeviceIDs @{Add="<DeviceId>"}
Set-CASMailbox -Identity kai@contoso.com -ActiveSyncBlockedDeviceIDs @{Remove="<DeviceId>"}

ActiveSyncAllowedDeviceIDs works the same way. Set either to $null to clear it.

Turn on ActiveSync debug logging

Set-CASMailbox -Identity kai@contoso.com -ActiveSyncDebugLogging $true -ActiveSyncMailboxPolicy Management

How do I allow SMTP AUTH for only some mailboxes?

Microsoft recommends turning SMTP AUTH off for the whole organization and back on only for mailboxes that need it. The mailbox setting wins over the organization setting.

SmtpClientAuthenticationDisabled on the mailbox Result
$true SMTP AUTH off for this mailbox
$false SMTP AUTH on for this mailbox
$null (default) Uses the organization setting
  1. Turn it off for the organization:
Set-TransportConfig -SmtpClientAuthenticationDisabled $true
Get-TransportConfig | Format-List SmtpClientAuthenticationDisabled
  1. Turn it on for one mailbox:
Set-CASMailbox -Identity scanner@contoso.com -SmtpClientAuthenticationDisabled $false
  1. Or for a list of mailboxes in a text file, one per line:
$Allow = Get-Content "C:\My Documents\Allow SMTP AUTH.txt"
$Allow | foreach {Set-CASMailbox -Identity $_ -SmtpClientAuthenticationDisabled $false}

Leave every other mailbox at $null. Source: Enable or disable SMTP AUTH in Exchange Online.

How do I check the change?

Get-CASMailbox -Identity scanner@contoso.com | Format-List SmtpClientAuthenticationDisabled

False means on, True means off, and blank means the organization setting applies. To list every mailbox with it turned off:

$Users = Get-CASMailbox -ResultSize unlimited
$Users | where {$_.SmtpClientAuthenticationDisabled -eq $true}

More on reading these settings: Get-CASMailbox in PowerShell.

Can I do this without PowerShell?

Yes, for the main protocols. In the Exchange admin center go to Recipients > Mailboxes, select the mailbox, open Email apps & mobile devices on the General tab, choose Manage email apps settings, flip the toggles and select Save. Source: Managing email apps for user mailboxes.

What only works on-premises?

MAPIBlockOutlookVersions blocks older Outlook builds in Exchange Server. For example, 15.0.4569 allows only Outlook 2013 SP1 or later:

Set-CASMailbox -Identity kai@contoso.com -MAPIBlockOutlookVersions 15.0.4569

The default is blank. Set it to $null to remove the block.

Troubleshooting

Problem Cause Fix
A protocol setting has no effect The protocol itself is $false, so its other settings are ignored Turn the protocol on first
EwsEnabled $true still blocks EWS Set-OrganizationConfig -EwsEnabled is $false Check the organization setting with Get-OrganizationConfig
SMTP AUTH still fails after $false Security defaults are on, or an authentication policy blocks basic auth for SMTP Check security defaults and authentication policies
The new Outlook stops working OWAEnabled is $false Set OWAEnabled back to $true
EwsAllowList does nothing It only applies with EwsEnabled $true and EwsApplicationAccessPolicy EnforceAllowList Set both

Summary

  • Set-CASMailbox turns protocols on or off per mailbox; everything defaults to on.
  • $false on a protocol makes its other settings ignored.
  • For SMTP AUTH, turn it off org-wide and set $false only on mailboxes that need it.
  • Check your work with Get-CASMailbox.

Related: Get-CASMailbox, Get-Mailbox, Get-OrganizationConfig, Install the Exchange Online PowerShell module.

Meeting Room 365 turns any iPad or Android tablet into a room display for Exchange and Microsoft 365 calendars. See the features or pricing: $9 a room a month.

Add a display to your office

Every room, on the door.

Live availability on every meeting room. Works with Microsoft 365, Exchange and Google Workspace.