Hi Naresh
Check this code...
Call this method from where you need.
public void email(string e_id)
{
MailMessage mg = new MailMessage();
mg.From = new MailAddress("bliss.care49@gmail.com"); //create an account in gmail
mg.To.Add(new MailAddress(e_id));
mg.Subject = "products bought from EBliss.com"; //optional
mg.Body = datatb(); //optional code
mg.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
NetworkCredential credential=new NetworkCredential("bliss.care49@gmail.com","projectqwerty"); //account id & password
smtp.EnableSsl=true;
smtp.UseDefaultCredentials=false;
smtp.DeliveryMethod=SmtpDeliveryMethod.Network;
smtp.Credentials=credential;
smtp.Send(mg);
}
Regards,
Denny Kurian
Naresh2k3406, if this helps please login to Mark As Answer. | Alert Moderator