refactor freemark mail