I'm trying to send an email with an SmtpClient, but I get a security error when it tries to create the client. The troubleshooting tips mention security requirements when deploying an office solution, but I'm having trouble finding any information about how to configure that. Is there a special permission in Sharepoint somewhere to allow web parts to use SmtpClients? If so, I couldn't find it.

It seems there are multiple possible causes for this error, do you have any insight as to what is most likely to cause this issue?

Error when creating client


Have you tried enclosing your code in SPSecurity.RunWithElevatedPrivileges, this will run the code under App Pool account and thus have the permissions..

| improve this answer | |

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.