Sunday, 21 February 2016

Send Mail Using Sharepoint Utilities

using Microsoft.SharePoint.Utilities;
using System.Collections.Specialized;

public void SendMailUsingUtility(SPWeb web)
        {
            StringDictionary headers = new StringDictionary();
            headers.Add("to", "abc@abc.com");
            headers.Add("cc", "abc@abc.com");
            headers.Add("bcc", "abc@abc.com");
            headers.Add("from", "abc@abc.com");
            headers.Add("subject", "Mail Using Utility");
            headers.Add("content-type", "text/html");

            string bodyText = "body text goes here !";

            SPUtility.SendEmail(web, headers, bodyText.ToString());
        }

No comments:

Post a Comment