public void mail()
{
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
System.Net.Mail.SmtpClient smtpClient = new SmtpClient();
//create the mail message
//set the addresses
mail.From = new MailAddress("kamalakkanavar@gmail.com");
mail.To.Add(TextBox1.Text);
mail.ReplyTo = new MailAddress("kamalakkanavar@gmail.com");
//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";
//This method has been deprecated.
//mail.Headers.Add("Return-Receipt-To", "p.khandelwal@yahoo.com");
//Use this if you need an delivery notification of an email. DeliveryNotificationOption is an enumeration
//and can be used to set the delivery notification on the following options:
//1. Delay
//2. Never
//3. None
//4. OnFailure
//5. OnSuccess
//You can use also use OnFailure enum with OnSuccess enum. If in case the e-mail fails to delivered you'll get notification for
//both the cases
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnSuccess;
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.Delay;
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.Never;
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.None;
//Add "Disposition-Notification-To" for Read receipt
mail.Headers.Add("Disposition-Notification-To", "kamalakkanavar@gmail.com");
//Set the SMTP server. You can also set the hostname instead of IP Address
smtpClient.Host = "relay-hosting.secureserver.net";
mail.Priority = System.Net.Mail.MailPriority.High;
smtpClient.Send(mail);
//Send the e-mail
// smtp.Send(mail);
}