I have scenario wherein i have to send email to users when an email is received. That is there is a Sharepoint library for which incoming email so configured. On receipt of email i have to do some processing and send email further users.

For this i am trying to use SPUtility.SendEmail(). But it requires SPWeb object. Whereas in EmailReceived() parameters doesn't contain properties parameter through which i can get SPWeb object. I tried explicitly creating SPWeb object using below code;

SPSite spSite = new SPSite(list.ParentWebUrl);
               //SPWeb spMySite = spSite.OpenWeb();// .AllWebs["Home"];
               SPWeb spRootsite = spSite.RootWeb;

But this code doesn't execute debugger skips these lines.

Kindly let know how i achieve this requirement in a easy way. I am using SP 2010.

1 Answer 1


Eventually it got figured out. the code is all correct. however there is weired behavior of Event Receiver that, when ever you change code and deploy you need to restart the SharePoint Timer server in (Services.msc). Else the debugger will run old code itself. The email is getting sent as expected.


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.