code formats emails properly, needs refactoring. (minimum: replace string ids in domains_and_formats with lambdas or something similar.)