Wednesday, June 24, 2015

How to send a mail in sharepoint programatically

 public static bool SendEmail(SPWeb spWeb, string to, string subject, string body)
        {
            bool isMailSent = false;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                //isMailSent = SPUtility.SendEmail(spWeb, true, true, to, subject, body);

                isMailSent = SPUtility.SendEmail(spWeb, true, false, to, subject, body); //With HTML Content

            });
            return isMailSent;


        }

No comments:

Post a Comment