/// <summary> /// </summary> /// Sends an email to the selected users /// <param name="web">The web.</param> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="cc">The cc.</param> /// <param name="bcc">The BCC.</param> /// <param name="subject">The subject.</param> /// <param name="body">The body.</param> /// <param name="isHtml">if set to <c>true</c> [is HTML].</param> public void SendEmail(SPWeb web, string from, string to, string cc, string bcc, string subject, string body, bool isHtml) { if (!string.IsNullOrEmpty(to)) { var headers = new StringDictionary{ {"to", to}, {"subject", subject}, {"content-type", isHtml ? "text/html" : "text/plain"} }; if (!string.IsNullOrEmpty(from)) { headers.Add("from", from); } if (!string.IsNullOrEmpty(cc)) { headers.Add("cc", cc); } if (!string.IsNullOrEmpty(bcc)) { headers.Add("bcc", bcc); } SPUtility.SendEmail(web, headers, body); } }
Tuesday, June 11, 2013
Extension Method to Send HTML Emails in SharePoint
Subscribe to:
Posts (Atom)