Simple code to send the email gmail SMTP.
Add Namespaces :
Add Namespaces :
using System.Net.Mail;
Code :
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); //Enter your SMTP address
mail.From = new MailAddress("your_emailID@gmail.com");
mail.To.Add("to_address");
mail.Subject = "Test EMail";
mail.Body = "Test SMTP mail from GMAIL";
SmtpServer.Port = 25;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
Thanx....
ReplyDelete