How is a confirmation email sent on an order placement?

How to programmatically detect an order transactional email sending process?