How to send email notification based on condition?