Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- MailMessage mail = new MailMessage();
- mail.To.Add("color.shadow@yahoo.com");
- mail.From = new MailAddress("abc@gmail.com");
- mail.Subject = "Reservation Status";
- string Body = "Greeting from us." +
- " You may view your booking details at your profile now." +
- " Have a nice day." +
- "Thank you.";
- mail.Body = Body;
- mail.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient("localhost", 25);
- smtp.Host = "smtp.gmail.com";
- smtp.Credentials = new System.Net.NetworkCredential
- (abc@gmail.com", "abcdef");
- smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
- smtp.EnableSsl = true;
- smtp.Send(mail);
- Label1.Text = "Mail Send...";
- }
- catch (Exception ex)
- {
- Label1.Text = ex.Message;
- }
- }
Add Comment
Please, Sign In to add comment