Add functionality for retrieving the actual message. Refactor code a little bit.
Write attachmen to file.