This is a copy/paste of the email preview code, but using the export command instead of `email --test`.