Trying to send email from Godaddy Hosting!
Its show below error:
Request for the permission of type 'System.Net.Mail.SmtpPermission,
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Solution :
MailMessage mail = new MailMessage();
mail.From = new MailAddress("email address", "FriendlyName");
mail.To.Add("send to email address");
mail.Subject = "Subject for email";
mail.Body = "Some Message";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("smtp.mydomain.com");
smtp.Host = "relay-hosting.secureserver.net";
smtp.Port = 25;
smtp.EnableSsl = false;
smtp.Credentials = new NetworkCredential("email_address", "password");
smtp.Send(mail);
Its show below error:
Request for the permission of type 'System.Net.Mail.SmtpPermission,
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Solution :
MailMessage mail = new MailMessage();
mail.From = new MailAddress("email address", "FriendlyName");
mail.To.Add("send to email address");
mail.Subject = "Subject for email";
mail.Body = "Some Message";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("smtp.mydomain.com");
smtp.Host = "relay-hosting.secureserver.net";
smtp.Port = 25;
smtp.EnableSsl = false;
smtp.Credentials = new NetworkCredential("email_address", "password");
smtp.Send(mail);
0 comments :
Post a Comment