About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.

Wednesday 11 December 2013

SPUtility.SendEmail in SharePoint 2010

public static void SendEmail(string strTo,string strSubject,string strBody)
        {
            try
            {
                StringDictionary headers = new StringDictionary();
                headers.Add("to", strTo);
                //headers.Add("cc","anil@test.com");
                //headers.Add("bcc","narendra@test.com");
                headers.Add("from","abhilash@test.com");
                headers.Add("subject", strSubject);
                headers.Add("content-type","text/html");
                SPUtility.SendEmail(SPContext.Current.Web, headers, strBody);

                //SPUtility.SendEmail(SPContext.Current.Web, true, false, strTo, strSubject, strBody);
            }
            catch (Exception ex)
            {
                Wipro.Novartis.Tablon.LoggingService.LogMessage(TablonConstants.LOG_CATEGORY, ex.StackTrace);
            }
        }

No comments:

Post a Comment