Call this Method in Your Code and Add your Gmail account Credentials
protected void SendMail()
protected void SendMail()
{ // Gmail Address from where you send the mail var fromAddress = "Gmail@gmail.com";
// any address where the email will be sending var toAddress = YourEmail.Text.ToString(); //Password of your gmail address
string fromPassword = "Password"; string subject = ""; /Your Mail Subject string body ="";// Your Content // smtp settings var smtp = new System.Net.Mail.SmtpClient(); { smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(fromAddress, fromPassword); smtp.Timeout = 20000; } // Passing values to smtp object smtp.Send(fromAddress, toAddress, subject, body); }
No comments:
Post a Comment