I have winform application or console application. now i want to capture if user close application clicking on cross button or close application from task manager.
before closing i want to send a mail and after mail sent application will be close. how could i capture winform or console application terminating from task bar?
please guide me how to do it by a sample code.