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 ...
protected void btnSubmit_Click(object sender, EventArgs e) { string strcon = ConfigurationManager.ConnectionStrings["prakashConnectionString2"].ConnectionString; con = new SqlConnection(strcon); con.Open(); SqlCommand cmd = new SqlCommand("SELECT username,password FROM getezee Where mail= '" + txtEmail.Text.Trim() + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); con.Close(); if (ds.Tables[0].Rows.Count > 0) { MailMessage Msg = new MailMessage(); Msg.From = new MailAddress("prakashzon@gmail.com"); Msg.To.Add(txtEmail.Text); Msg.Subject = "Your Password Details"; Msg.Body = "Hi, <br />Please check your Login Detailss<br /><br />Your Username: " + ds.Tables[0].Rows[0]["username"] + "<br /><br />Your Password: " + ds.Tables[0].Rows[0]["password"] + "<br /><br />"; Msg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); smtp.Credentials = new System.Net.NetworkCredential("getezee.social@gmail.com", "Risingstar"); smtp.EnableSsl = true; smtp.Send(Msg); lbltxt.Text = "Your Password Details Sent to your mail"; txtEmail.Text = ""; } else { lbltxt.Text = "The Email you entered not exists."; }
<div> <table cellspacing="2" cellpadding="2" border="0" class="auto-style18"> <tr><td class="auto-style20"></td><td class="auto-style20"><b>Forgot Password</b></td></tr> <tr><td><b>Enter Your Email:</b></td><td><asp:TextBox ID="txtEmail" runat="server" /></td></tr> <tr><td class="auto-style19"></td><td class="auto-style19"><asp:button ID="btnSubmit" Text="Submit" runat="server" CssClass="Button" OnClick="btnSubmit_Click"/></td></tr> <tr><td colspan="2" style=" color:red"><asp:Label ID="lbltxt" runat="server"/></td></tr> </table> </div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)