Fixing sending email to happen once rather than for each user causing multiple emails