actually i will give mail id in my text box but its not sending.i don't know why its not sended.can any body help me
try
{
//textbox3.text is we can give mail id in that
MailAddress mailfrom = new MailAddress("TextBox3.Text");
MailAddress mailto = new MailAddress("sankarreddyece@gmail.com");
MailMessage newmsg = new MailMessage(mailfrom, mailto);
newmsg.Subject = "Subject of Email";
newmsg.Body = "Body(message) of email";
////For File Attachment, more file can also be attached
//Attachment att = new Attachment ( "G:\\code.txt" );
//newmsg.Attachments.Add ( att );
SmtpClient smtps = new SmtpClient("smtp.gmail.com", 587);
smtps.UseDefaultCredentials = false;
smtps.Credentials = new System.Net.NetworkCredential("sankarreddyece@gmail.com", "640");
smtps.EnableSsl = true;
smtps.Send(newmsg);
//MessageBox.Show("mail Send");
}
catch (Exception ex)
{
//MessageBox.Show(ex.ToString());
}
sankarreddy