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:
- SPUtility.SendEmail - doesn't work in sandbox solutions.
- 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?