0

I'm trying to send an email with sharepoint's SPUtility.SendEmail() method, but according to Visual studio it doesn't exist. I have using Microsoft.Sharepoint and .Utilities included, but still nothing.

Am I missing an assembly or something? I'm on Sharepoint 2013 in .NET 4.5

Code below. Visual studio doesn't show any suggestions when I type SendEmail for any overloads.

var web = SPContext.Current.Web;
SPUtility.SendEmail(web, false,false,"[email protected]","subject","message");
4
  • Are you using a Sandbox solution? Commented May 27, 2014 at 19:57
  • Show your code. Which overload are you using?
    – jkandiko
    Commented May 27, 2014 at 19:59
  • I am using a sandbox solution i believe. No overloads are available, see edit.
    – DLeh
    Commented May 27, 2014 at 20:00
  • Did you get runtime or compile time exception?
    – Roman
    Commented May 27, 2014 at 20:25

1 Answer 1

3

SPUtility.SendEmail() is not available in a sandbox solution.

You can use the SendEmail activity in a SharePoint Designer Workflow to accomplish your task.

1
  • I created a new project as a farm solution and it is now detecting the method. Hopefully I will be able to get this working. I wish they would've said something about that on the MSDN page for this method. Thank you!
    – DLeh
    Commented May 27, 2014 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.