0

I'm trying to send an email using c# sharepoint library. Though I'm getting an error that reads...

Error in test: Object reference not set to an instance of an object.  

The code I'm executing is as follows. It's fairly simple, though I can't figure out where I'm going wrong.

                string SPSite = "spsite";                           
                using(SPSite objSite = new SPSite(SPSite))
                {
                    using(SPWeb oweb = objSite.OpenWeb())
                    {

                        SPUtility.SendEmail(oweb, false, false, "email@email.com", "Title test", "this is the body");
                    }
                }
0

did you check if your mail server is good. bool blnIsEmailServerSet = SPUtility.IsEmailServerSet(web);

An alternate way to get this done: http://emailfromsharepoint.blogspot.com/2012/04/send-email-from-sharepoint.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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