I need to show a popup-window with a basic e-mail layout and send the e-mail after pressing the send button. The popup, I've created and also the webpart within. But when I want to send the e-mail, it crashes at the following line:
SmtpClient client = new SmtpClient(SMTP_HOST, SMTP_PORT);
With SMTP_HOST and SMTP_PORT the settings from my exchange online account:
private const string SMTP_HOST = "pod51014.outlook.com"; private const int SMTP_PORT = 587;
System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Net.Mail.SmtpClient.Initialize() at System.Net.Mail.SmtpClient..ctor(String host, Int32 port) at ...
Does anyone know what's my problem here?