private void WriteBackupLog(string dbName, string status) { ObjUtil.WriteToFile("Log Date : " + DateTime.Now.ToString(), "backup.log", true); ObjUtil.WriteToFile("Database Name : " + dbName, "backup.log", true); ObjUtil.WriteToFile("Status : " + status, "backup.log", true); ObjUtil.WriteToFile("______________________________________", "backup.log", true); }
/// <summary> /// SendEmail function to send email. /// </summary> //public bool SendEMail(string strTo, string strSubject, string strBody, string strFrom, string strpass) public void SendEMail() { try { var smtp = new System.Net.Mail.SmtpClient(); { smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(From, Password); smtp.Timeout = 20000; } // Passing values to smtp object smtp.Send(From, To, Sub, Body); IsMail = true; //return true; } catch (Exception ex) { IsMail = false; clsUtility ObjUtil = new clsUtility(); string temp = "From: " + From + " To: " + To + " Sub: " + Sub + " Body: " + Body + " "; ObjUtil.WriteToFile("Error Occured " + temp + ex.ToString(), "Error"); //return false; } }