SharePoint and Exchange is a great ever combination of making a productive environment these days you may have heard from Microsoft. Indeed, the combination offers you full collaboration features and unblocks numerous of choke points in communication. However, the integration between SharePoint and Exchange is not as easy as installing Exchange, configuring out-going setting and performing full synchronization. This sounds like a very normal case all of us know, but not really a list to make things become complete.
Recently I have seen several misunderstandings about email address in SharePoint 2013 from my clients and colleagues. Most of them let User Profile Synchronization do its job and were in trouble as to why email addresses in SharePoint didn’t get updated. As a result, end users didn’t get email notification from SharePoint making a big problem in business operation. On several issues about email address, this article is going to clarify a few things. It will also provide some tips to troubleshooting common email-related cases in SharePoint 2013.
Note: this article is not going to target to business user, instead to people who work with SharePoint as an administrator or a developer.
Where do you see email address in SharePoint?
Email address of a user object in User information list is the very first place for the answer. This email address is used for email process. If an email is outdated, the owner will not receive any notification SharePoint via your email server. I would say it’s an actual working email in SharePoint. To see it, browse this URL http://<your_sitecollection>/_layouts/userdisp.aspx
If you are using Social features provided by User Profile Service application, you will be redirected to your personal site.
From PowerShell, use the following command line to check the email address:
Get-SPUser –Identity “loginName” –Web “your_site_collection_URL” | FL
Make sure the LoginName value is form of claim (i:0#.w|)
If you like to do something like a DBA, query the UserInfo table of the content database where your site collection is stored within. Below is the sample T-SQL code snippet
SELECT TOP 10
The second place you’ve got to see the email address is user profile service application. Just open it and navigate to Manage User Profiles page.
How does email get updated to the User Information List?
As said earlier, the email address you see in User Information List is used by SharePoint for notification. Hence, understanding how it is synchronized or updated to the list is very important and will support your troubleshooting.
In all of basis, SharePoint has User Profile Synchronization service responsible for mapping data from an identity provider to each user profile in SharePoint relatively. The mapping depends on how you set in Manage User Properties page. By default, Work email property is mapped to proxyAddress attribute in Active Directory.
Described by Microsoft, a proxy address is the address by which a Microsoft Exchange Server recipient object is recognized in a foreign messaging system. Proxy addresses are required not just for users, but for all recipient objects, such as contacts, distribution groups, and public folders. Another description from Microsoft Exchange team is that proxyAddress is the main attribute where email address information is kept. Because proxyAddress can contain multiple values, I suppose they are as follows:
- SMTP:email@example.com (primary address)
- smtp: thuanNN@sg.ts-tech.net (secondary address)
The description does tell us that if SharePoint synchronizes proxyAddress, there will be multiple values in Work email property.
When an email is synchronized or updated to a user profile, there are two timer jobs that are responsible for email synchronization to the user information list.
- User Profile to SharePoint Full Synchronization: synchronizes user information from the user profile application to SharePoint users and synchronizes site membership from SharePoint to the user profile application.
- User Profile to SharePoint Quick Synchronization: synchronizes user information from the user profile application to SharePoint users recently added to a site.
The flow above gives you an overview of how proxyAddress is synched to user profile and is updated to the UserInfo table of a content database.
How to edit the mapping of email property
Keeping proxyAddress by default mapped to Work email property is not recommended. First, if you do not have Microsoft Exchange, proxyAddress property would be always empty. Secondly, if proxyAddress has multiple values, User Profile Synchronization doesn’t understand multi-value format while the property type is E-mail. Therefore, we need to map the email property to the mail attribute in Active Directory.
This way facilitates email management because you can edit to troubleshoot anytime you want without the need of rights on Exchange server. It’s also to let SharePoint understand that mail attribute only contains a single value.
From SharePoint User Profile Service Application page, click Manage User Properties. Locate to Work email property and click Edit (from a small arrow beside).
Scroll down to Property Mapping for Synchronization setting, click Remove
Under Add New Mapping setting, select synchronization connection under Source Data Connection. Under Attribute, select mail. Under Direction, select Import.
Click Add. Make sure you see the new mapping of mail attribute in Property Mapping for Synchronization setting. Click OK to complete then verify the mapping before full synchronization.
Perform full synchronization and open Forefront Identity Manager (C:\Program Files\Microsoft Office Servers\15.0\Synchronization Service\UIShell\miisclient.exe) to monitor and test the result.
In almost cases when an end user doesn’t receive an email notification while his colleague is, folks often leave a look at the User Information List where that end user resides. They also seem to be in trouble with User Profile Service application and Exchange server.
If you have ever encountered such a case, make sure the email address in the user information list has been newly updated. Otherwise, SharePoint will send the request of old email address to email server. If the email address is old, check the email address of the affected end user in User Profile Service Application. If the user profile has the new email address updated, chances are User Profile to SharePoint Full Synchronization and User Profile to SharePoint Quick Synchronization timer jobs haven’t worked correctly. In this case, you need to check Last run time value and history of each timer job. You would need to clear configuration cache to update the configuration database and make things come back normally.
In case the email in the user profile is still not correct, open Forefront Identity Manager to see synchronization history, status and error if any. Also make sure User Profile Synchronization service is started and isn’t affected by any automatic SharePoint backup script using server-side object model.
Until you verify the email address in both locations (user profile service application and user information list) are updated correctly, you can begin testing SMTP status. There is a PowerShell script to do that:
$site = New-Object Microsoft.SharePoint.SPSite(“your_sitecollection_url”)
$web = $site.OpenWeb()
$sent = [Microsoft.Sharepoint.Utilities.SPUtility]::SendEmail($web,0,0,”recipient_address”,”Email Testing”,”Kindly ignore as it’s a testing purpose”)
If the output is true, your SMTP is working well with SharePoint. Otherwise there is a problem between the SMTP server and your SharePoint.
If you need a quick way to update the email address for an affected end user, use the following PowerShell command line:
Set-SPUser -Identity “loginName” -email “new_email_address” –Web “site_collection_url”
Email in SharePoint looks pretty complicated as it presents in several different locations and requires a complete process to make email notification in SharePoint work. To troubleshoot, you need to be familiar with User Profile Service application, a little more with Forefront Identity Manager and some skills for timer job troubleshooting. Or all of these things can be out of you list if you feel confident of making a custom job that can directly reach to Active Directory via LDAP syntax then update directly to user information list utilizing SPUser class. That’s your choice.
You may need to read Synchronizing User Account in Active Directory to SharePoint