How to programmatically detect the sales transactional email sending process?

See also: