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.