add database creation to sql template
handle failing mails more gracefully in MailService with error logging