SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a custom web part in an Office 365 environment. I am trying to send email to a user during the execution of the code in the web part.

I have tried two alternatives:

  1. SPUtility.SendEmail - doesn't work in sandbox solutions.
  2. System.Net.Mail.SmtpClient - can't get this to work, probably because the SMTP server host names that I tried are wrong. Still, the error message (something related to minimum trust) leads me to believe this cannot be made to work.

One way that I haven't tried is to create a workflow in code, which will then send the email.

Will the workflow way work and is there something that I am missing?

share|improve this question
up vote 7 down vote accepted

The System.Net.Mail namespace works with on-premise Sandbox solutions but does not work with Office 365, so there is no way to send email from code. The "Send Email" activitiy in SharePoint Designer workflows in Office 365 does work, so yes, you can use workflow to send email.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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