class Program { static void Main(string[] args) { try { throw new Exception("Expection"); } catch (Exception ex) { ex.SendErrorEmail(); } } } public static class MyExtension { public static void SendErrorEmail(this Exception ex) { //Write your send mail code //.... smtpClient.Send(mailMessage); } }
No comments:
Post a Comment