When using the code from this well read post
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential("my email", "my password")
};
I constantly get a System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission.
Does this code have to be used in some special hosting environment or am I missing somthing obvious?
Thanks!