private void send-mail( )
{
string senderID = "sender@gmail.com";// use sender’s email id here..
const string senderPassword ="password of sender"; // sender password here…
Console.WriteLine("sending mails......");
SmtpClient smtp = new SmtpClient
{
Host = "smtp.gmail.com", // smtp server address here…
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
Credentials = new System.Net.NetworkCredential(senderID, senderPassword),
Timeout = 30000,
};
MailMessage message = new MailMessage(senderID, "receiver@gmail.com");
message.subject= "hi ";
message.Body=" ur body ";
message.subject= "hi ";
message.Body=" ur body ";
smtp.Send(message);
Console.WriteLine("mail sended successfully");
}