Sending email is a key function of enterprises solutions. Inside SharePoint collaboration environment you always need to send email from within SharePoint. For this purpose you can use SPUtility class SendEmail method.

Below is a simple example code for sending email using SPUtility.

Add namespace reference:

private viod SendEmail()
  try {
      using (SPSite site = new SPSite(SPContext.Current.Site.ID,
        using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
         SPUtility.SendEmail(web, true, true, "[email protected]",
         "Subject", "Your message body will go here");
  catch (Exception ex) {}

As you can see that sending email using SPUtility is straightforward, please also note the following considerations

1.   No attachment allowed

2.   Message body size cannot exceed 2048 characters.

3.   The form address will be the “Outbound Sender Address” configured in the central admin.


Comments are closed.

About Us

Follow Us

Email: contact@keapoint.com
Phone:  0208 7852 888

Registered Address: 1 Amber Close, Reading, RG6 7ED. United Kingdom

Company No. 11586817