Email notification not working properly