How to send E-Mail using SPUtility.SendEmail in SharePoint?

SharePoint SPUtility class has SendEmail method which is used to send email to any email address. By default, SPUtility.SendEmail() method picks the ‘From address’ from Outgoing E-Mail Settings in Central administration. Use SPUtility.IsEmailServerSet method to check if server is configured with SMTP mail settings.

Here is a C# Example for sending E-mail using SPUtility.SendEmail:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.IO;
using Microsoft.SharePoint.Utilities;
using System.Collections.Specialized;

namespace HideUserInfo
    class SendEMail
        static void Main(string[] args)

            using (SPSite oSPSite = new SPSite(""))  //Site collection URL
                using (SPWeb oSPWeb = oSPSite.OpenWeb("News"))  //Subsite URL
                    StringDictionary headers = new StringDictionary();

                    headers.Add("from", "");
                    headers.Add("to", "");
                    headers.Add("subject", "Welcome to the SharePoint");
                    headers.Add("fAppendHtmlTag","True"); //To enable HTML format

                    System.Text.StringBuilder strMessage = new System.Text.StringBuilder();
                    strMessage.Append("Message from CEO:");
                    strMessage.Append("<span style='color:red;'> Make sure you have completed the survey! </span>");
                    SPUtility.SendEmail(oSPWeb, headers, strMessage.ToString());


How to use SPUtility.SendEmail in PowerShell?

$site = New-Object Microsoft.SharePoint.SpSite("")

#We can use: Get-SPWeb in SharePoint 2010 
$web = $site.OpenWeb()

$mail = [Microsoft.Sharepoint.Utilities.SpUtility]::SendEmail($web,0,0,"","Subject of the Mail","mail body")

SPUtility.SendEmail method MSDN Link

SPUtility sendemail method has some limitations like:

  • No support for attachments
  • Message body should not exceed 2048 characters.

To overcome the limits, use the System.Net.Mail class methods as explained in my another Send E-mail Programmatically in C#. To retrieve Outbound SMTP Server Use new MailAddress(WebApplication.OutboundMailSenderAddress, fromName);

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

One thought on “How to send E-Mail using SPUtility.SendEmail in SharePoint?

  • Hi, Im not getting emails when i keep in BCC , can you help i copy pasted your code, its working fine for To and CC


Leave a Reply

Your email address will not be published. Required fields are marked *