Programmatically specify sender e-mail address for My Site e-mail notifications in SharePoint 2010

By Vijai Anand Nov 21, 2011
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:

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.SharePoint;

using System.Web;

using Microsoft.Office.Server.UserProfiles;

 

namespace MySiteEmailSenderName

{

    class Program

    {

        static void Main(string[] args)

        {

            using (SPSite site = new SPSite("http://serverName:60001/sites/TestSiteColl"))

            {

                SPServiceContext context = SPServiceContext.GetContext(site);

                UserProfileManager upm = new UserProfileManager(context);

                upm.MySiteEmailSenderName = "anystring@somestring.com";

            }

        }

    }

}

Vijai Anand

Vijai Anand has been working in IT industry for over 5 years. He holds Bachelor's degree in Electronics and Communication Engineering. Vijai write articles and blogs related to SharePoint 2013, SharePoint 2010, Silv... Read more

COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs