use namespace System.Net.Mail;
use this code in send button click oe where ever u want
try
{
SmtpClient sc = new SmtpClient("smtp.gmail.com", 25);
sc.EnableSsl = true;
sc.Credentials = new System.Net.NetworkCredential(TextFrom.Text, textPwd.Text);
sc.Send(TextFrom.Text, TextTo.Text, TextSubject.Text, TextMatter.Text);
Label1.Text = "Your Message sent Successfully";
}
catch
{
Label1.Text = "An Error has occured;Plz Enter Valid data";
}
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment