Send Mail Using gmail In asp.net c#.
Introduction : In this article i will show you how to send mail
in asp.net using gmail account.It is very simple just you need to pass
your gmail account email address and password in
System.Net.NetworkCredential() . And also you need to set host= smtp.gmail.com ,port =587 .I
have following code to send mail using gmail account in asp.net c# .
protected void btnSendMail_Click1(object sender, EventArgs e) { string myEmailAddress = "your gmail account"; string mypwd = "your gmail account password"; string toEmailAddress = "to email address"; string subject = "Test Subject"; string mailbody = "Test body"; var client = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587) { Credentials = new System.Net.NetworkCredential(myEmailAddress, mypwd), EnableSsl = true }; client.Send(myEmailAddress, toEmailAddress, subject, mailbody); }