update alert email logic