Added email attachment function and history