public bool Send() { string user = ConfigurationManager.AppSettings["email_username"].ToString(); string password = ConfigurationManager.AppSettings["email_password"].ToString(); SmtpClient SmtpServer = new SmtpClient(); SmtpServer.Credentials = new System.Net.NetworkCredential(user, password); SmtpServer.Port = 25; SmtpServer.Host = "smtp.rediffmail.com"; SmtpServer.EnableSsl = true; MailMessage mail = new MailMessage(); try { mail.From = new MailAddress(user, "SUBJECT", System.Text.Encoding.UTF8); mail.To.Add(new MailAddress(to)); mail.Subject = subject; mail.Body = message; mail.IsBodyHtml = true; mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; mail.ReplyTo = new MailAddress(frm); SmtpServer.Send(mail); } catch (Exception err) { return false; } return true; }
SmtpServer.EnableSsl = true;
SmtpServer.EnableSsl = false;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)