Click here to Skip to main content
15,909,498 members

Comments by veera kishore (Top 2 by date)

veera kishore 3-Oct-16 8:18am View    
i used this usedefaultcredential= false as you said..but i had error here.pls find solution
veera kishore 3-Oct-16 8:17am View    
pls tell me i don't know how to add this credential

this is my code pls make sure tell me the solution.

if (ds.Tables[0].Rows.Count > 0)
{
MailMessage Msg = new MailMessage();
// Sender e-mail address.
Msg.From = new MailAddress(txtEmail.Text);
// Recipient e-mail address.
Msg.To.Add(txtEmail.Text);
Msg.Subject = "Your Password Details";
Msg.Body = "Hi, Please check your Login DetailssYour uname: " + ds.Tables[0].Rows[0]["uname"] + "Your pass: " + ds.Tables[0].Rows[0]["pass"] + "";
Msg.IsBodyHtml = true;
// your remote SMTP server IP.
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("yourusername@gmail.com", "yourpassword");
Credentials = new NetworkCredential("yourusername@gmail.com", "yourpassword");
smtp.EnableSsl = true;
smtp.Send(Msg);
//Msg = null;
lbltxt.Text = "Your Password Details Sent to your mail";