Added email exporting and tests