I have simple event receiver start after save item, do something and send mail, there is part of code:

SPSecurity.RunWithElevatedPrivileges(delegate ()
MailMessage mailMessage = new MailMessage();
mailMessage.IsBodyHtml = true;
mailMessage.From = new MailAddress(settings.MailSender, settings.MailSenderTitle);
mailMessage.Subject = subject;
mailMessage.Body = stringBuilder.ToString();
SmtpClient smptClient = new SmtpClient(settings.MailSMTP);
smptClient.Credentials = CredentialCache.DefaultNetworkCredentials;

It's work only if the user has full control permissions. I try change smptClient.Credentials to new NetworkCredential(ReadAppSettings.SP_SuperUser, ReadAppSettings.SP_SuperUserPassword, "domain"); but the same issue. But if the user that not have full control created for them self for example alter on list a do some change, server will send to him mail. So i thinking that my problem is in code, so how force code to sending mail if user don't have permission.

Your Answer

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

Browse other questions tagged or ask your own question.