hi created one website, am sending mail with attachment on my hosting server. I getting following error:
but sending mail with attachment working in local host. What settings i have to do. please help me.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
tekkPosted May 21, 2010, 1:51 AM
Thanks for reply,
While sending mail in my "web hosting server" is working perfectly. sending mail with attachment code here:
MailMessage objEmail = new MailMessage();
objEmail.To.Add(txtemail.Text.ToString());
objEmail.From = new MailAddress("[email protected]");
objEmail.Subject = "User Account Details";
objEmail.Body ="Your User Account was created as a " ;
objEmail.Priority = System.Net.Mail.MailPriority.High;
objEmail.IsBodyHtml = true;
string strFileName = FileUpload1.PostedFile.FileName;
Attachment attFilename = new Attachment(strFileName);
objEmail.Attachments.Add(attFilename);
SmtpClient smtpclient = new SmtpClient();
smtpclient.Send(objEmail);
SMTP Server mention in webconfig.
but i have doubt, Is it attached document is saved on my web hosting server and then sent or what to do ?
and also please explain live credentials.
Please help me,
Advance thanks
CrishPosted May 20, 2010, 5:08 AM
first try to sending mail without attachment. If mail send functionality working perfectly in your server then give right to you attachment saved folder. It will work. Also check are you using live credentials for mail sending or not. because its needs (like emailid and serverport0