Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 981271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:30:56+00:00 2026-05-16T04:30:56+00:00

I had a solution to retrieve the user password when the user forgot the

  • 0

I had a solution to retrieve the user password when the user forgot the password. I did the code well, but the error appear with an SMTP exception (error sending). How can I fix this problem?

protected void Button1_Click(object sender, EventArgs e)
{
    using (SqlConnection con = Connection.GetConnection())
    {
        string sql = "Select Password From Registeration Where UserName=@UserName And Email=@Email";
        SqlCommand com = new SqlCommand(sql, con);
        com.CommandType = CommandType.Text;

        com.Parameters.Add("@UserName", SqlDbType.NVarChar, 50).Value = TxtUserName.Text;
        com.Parameters.Add("@Email", SqlDbType.NVarChar, 50).Value = TxtEmail.Text;
        SqlDataReader dr = com.ExecuteReader(CommandBehavior.SingleResult | CommandBehavior.CloseConnection);
        while (dr.Read())
        {
            SendMail("karim-gamal@elarabygroup.com", "xxxx", TxtEmail.Text, " Hi", "Hi" + dr["Password"].ToString());
        }
        Response.Redirect("");
    }
}


public static bool SendMail(string elarabyAccount, string password, string to, string subject, string message)
{
    try
    {
        NetworkCredential loginInfo = new NetworkCredential(elarabyAccount, password);
        MailMessage msg = new MailMessage();
        msg.From = new MailAddress(elarabyAccount);
        msg.To.Add(new MailAddress(to));
        msg.Subject = subject;
        msg.Body = message;
        msg.IsBodyHtml = true;
        SmtpClient client = new SmtpClient("smtp.elarabygroup.com", 8080);
        client.EnableSsl = true;
        client.UseDefaultCredentials = false;
        client.Credentials = loginInfo;
        client.Send(msg);

        return true;
    }
    catch (Exception)
    {
        return false;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:30:57+00:00Added an answer on May 16, 2026 at 4:30 am

    The documentation for SmtpClass states the following (emphasis mine):

    The connection established by the
    current instance of the SmtpClient
    class to the SMTP server may be
    re-used if an application wishes to
    send multiple messages to the same
    SMTP server. This is particularly useful when authentication or encryption are used establish a connection to the SMTP server.

    Since you’re using encryption (client.EnableSsl = true;) you should try to use a single SmtpClient instance to send your mails.

    Also, by creating a new instance of SmtpClient on every call of SendMail, you’re creating a new connection to the SMTP server; depending on the number of records you have, and thus the number of emails you want to send, it’s possible that the SMTP server refuses to accept any connections from you because of the high quantity, since it may think that you’re either issuing a DDoS attack or you’re trying to do other malicious things.

    As already mentioned above, just try to use a single SmtpClient instance.

    Another possible issue could be that the SmtpClient is not quitting the connection correctly by not issuing a QUIT command. This is a known bug, and is fixed in the Microsoft .NET Framework 4.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If i had two different application running under the same solution but using different
I have found some similar Que's on SO but had not find the solution.
I've tried to search for a solution for this, but have had no joy:
I've had a look at the similar questions, but haven't found a solution yet.
The solution is probably staring me in the face, but I haven't had any
Using visual studio 2008, I had a solution open and realized I need to
Solution: I had also moved ashx and asmx files at the same time as
I had my VB.NET project and associated solution (developed in Visual Studio 2005) in
Has anyone else had this issue and found a working solution? I've enabled the
Looking for a non-JS solution. Say I had something like this: <ul> <li> <form>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.