You must Sign In to post a response.
  • Category: ASP.NET

    I have a problem,please help me out

    private void SendPasswordResetEmail(string ToEmail, string UserName, string UniqueId)
    // MailMessage class is present is System.Net.Mail namespace
    MailMessage mailMessage = new MailMessage("", ToEmail);

    // StringBuilder class is present in System.Text namespace
    StringBuilder sbEmailBody = new StringBuilder();
    sbEmailBody.Append("Dear " + UserName + ",<br/><br/>");
    sbEmailBody.Append("Please click on the following link to reset your password");
    sbEmailBody.Append("<br/>"); sbEmailBody.Append("http://localhost/abc/Registration/ChangePassword.aspx?uid=" + UniqueId);

    mailMessage.IsBodyHtml = true;

    mailMessage.Body = sbEmailBody.ToString();
    mailMessage.Subject = "Reset Your Password";
    SmtpClient smtpClient = new SmtpClient("", 587);

    smtpClient.Credentials = new System.Net.NetworkCredential()
    UserName = "",
    Password = "abcd"
    smtpClient.EnableSsl = true;
    smtpClient.UseDefaultCredentials = false;


    while i running this page and enter the username it got a error and the error is:-

    The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

    how to solve this problem please help me out immediately...
  • #765290

    I'm not sure in which line you got this error, but as per error details, when you send mail through SMTP server, it's requires to validate the credentials, without that if you try to run it's giving this type of error message, I suggest you to debug the code and recheck in which line you got this error, and check whether the credentials you are passing is correct or not.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #765294

    Need to settings in your gmail account for authentication purpose check them then
    check your credentials are correct or not.

    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #765305
    Try using smtp.UseDefaultCredentials = true;
    As you had enabled SSL security through your application, provide correct gmail username and password.
    Also go to server via remote access, open browser and login into Gmail at least once, which will makes Gmail understand that the server and its IP Address belongs to you and will allow you to send emails through your application.
    Hope it helps.
    Shashikant Gurav

Sign In to post your comments