File creation and email sending