Refined mail function to send message on a few triggers