System.Security.SecurityException when sending email using GMAIL Account on Godaddy Shared Hosting server

arjunsingh
 
on Apr 24, 2013 11:11 PM
3464 Views

Sir i created a feedback form in which i receives user feedback on my  mail id once or twice the user is able to give feedback bt the error page pops up.Is the gmail that creating problem.

it shows custom error problem.But twice i was able to receive mail but after this i started getting this problem

or in web.config i have to add some security credentials

 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
	
        MailMessage mail = new MailMessage();
        mail.To.Add(TextBox1.Text(user enters his mail address));
        mail.CC.Add("myemail");
        mail.From = new MailAddress("myemail");
        mail.Subject = "Thanks For Registering";
        string body =" ";
        mail.Body = body;
        mail.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.EnableSsl = true;
        smtp.Host = "smtp.gmail.com";
        smtp.Port = 587;
        smtp.Credentials = new System.Net.NetworkCredential("mymailaddress", "password");
        smtp.Send(mail);
        TextBox1.Text = "";
            }

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Mudassar
 
on Apr 24, 2013 11:53 PM

Problem is Godaaddy does not allow to send email from other servers. There's nothing you can do. Contact Go Daddy