Updating emails to use the full URL and refactoring email templating code a little