Using PowerShell to Manage SharePoint Email Settings

Each SharePoint Document Library is capable of accepting Incoming Email. Here is how to manage the settings via PowerShell.

In SharePoint 2010, the SharePoint Management Shell must run as the Application Pool account when setting the EmailAlias property. Other properties can be set as a standard Shell Admin user.

First, bind to the Web and the List:

$web = Get-SPWeb http://webUrl
$list = $web.GetList("LibraryTitle")

When making a change to a list property, make sure to call the Update() method, for example:

$list.RootFolder.Properties.Add("vti_emailusesecurity", 1)

Here are the various settings you can apply. I’ll be translating from the SharePoint UI to the PowerShell property.


E-mail address (note this also sets Allow this document library to receive e-mail?)

$list.EmailAlias = "string_value" #should be the email first part only, e.g. "test" in ""

Group attachments in folders?

$list.RootFolder.Properties.Add("vti_emailattachmentfolders", "string_value") #valid values are "root", "sender", and "subject"

Overwrite files with the same name?

$list.RootFolder.Properties.Add("vti_emailoverwrite", 1) #1 = true, 0 = false

Save original e-mail?

$list.RootFolder.Properties.Add("vti_emailsaveoriginal", 1) #1 = true, 0 = false

Save meeting invitations?

$list.RootFolder.Properties.Add("vti_emailsavemeetings", 1) #1 = true, 0 = false

E-mail security policy:

$list.RootFolder.Properties.Add("vti_emailusesecurity", 1) #1 = true - Use Document Library Permissions, 0 = false - Allow All/Anonymous

To disable Incoming Email on a Library, simply run:

$list.EmailAlias = $null

Trevor Seward is a Microsoft Office Apps and Services MVP who specializes in SharePoint Server administration, hybrid scenarios, and SharePoint Online. He has been working with SharePoint for 16 years from SharePoint 2003 on up, managing environments with terabytes of content for 150,000+ user organizations. Trevor is an author of Deploying SharePoint 2016 and Deploying SharePoint 2019. You can find him on Twitter and in /r/sharepoint.