Programmatically specify sender e-mail address for My Site e-mail notifications in SharePoint 2010
In this blog you will see how to specify an e-mail address to use as the sender e-mail address for My Site e-mail notifications in SharePoint 2010 using SharePoint Object Model.
In SharePoint 2010 open the Application Management section in the Central Administration, click on Manage Service Applications. Click on User Profile Service application. Go to My Site Settings, click on Setup My Sites.
In this you could see an option My Site e-mail notifications which is used to specify an e-mail address to use as the sender e-mail address for My Site e-mail notifications.
Code Snippet:
C#
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Microsoft.SharePoint;using System.Web;using Microsoft.Office.Server.UserProfiles; namespaceMySiteEmailSenderName{ classProgram { staticvoidMain(string[] args) { using (SPSite site = new SPSite("http://serverName:60001/sites/TestSiteColl")) { SPServiceContext context = SPServiceContext.GetContext(site); UserProfileManager upm = new UserProfileManager(context); upm.MySiteEmailSenderName = "[email protected]"; } } }}
0 comments
Comments
Join the conversation! Your thoughts help the community grow.
Join to leave a comment
Members earn 10 SHARP for a comment, 10 SHARP for a reaction, and 250 SHARP for every blog they publish.
Join the conversation! Your thoughts help the community grow.