Created the background logic for creating a unique key and emailing to the user