Clean up e-mail, fix reporting logic on file write error