The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required
<p>I have a Problem, when i m sending a mail through this code then error is occured that "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. "</p>

<p>and my code is :</p>

<pre><code>protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{

    MailMessage mail = new MailMessage();
    mail.To.Add("info@msslindia.com");
    mail.From = new MailAddress("info@msslindia.com");
    string body = "&lt;table&gt;&lt;tr&gt;&lt;td&gt;Company Name:&lt;/td&gt;&lt;td&gt;" + txt_cname.Text + "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Address With No.:&lt;/td&gt;&lt;td&gt;" + txt_addwithno.Text + "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Contact Person:&lt;/td&gt;&lt;td&gt;" + txt_conperson.Text + "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Email Id&lt;/td&gt;&lt;td&gt;" + txt_email.Text + "&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Description&lt;/td&gt;&lt;td&gt;" + txt_description.Text + "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
    mail.Body = body;
    mail.IsBodyHtml = true;
    SmtpClient smtp = new SmtpClient();
    smtp.Host = "smtp.gmail.com";
    smtp.Port = 25;
    smtp.UseDefaultCredentials = true;
    smtp.Credentials = new System.Net.NetworkCredential("info@msslindia.com", "xyz");
    smtp.EnableSsl = true;
    smtp.Send(mail);


    txt_cname.Focus();
    txt_cname.Text = "";
    txt_addwithno.Text = "";
    txt_conperson.Text = "";
    txt_email.Text = "";
    txt_description.Text = "";

}
</code></pre>
