separate PDF from templates, refactored email sender