Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.