Question: How can I approach this? Could you help me?

The format of the text file is not very important. An possible format would be:

```
Email 1;Involved contact(s);Subject and preview;Date or time 
Email 2;Involved contact(s);Subject and preview;Date or time 
...

```

Answer: 
[GMail offers a RSS feed](http://mail.google.com/support/bin/answer.py?answer=13474) with the basic details of each mail.

I used this [XSL file](http://snippets.dzone.com/posts/show/1162) to transform that feed to a more readable format
![enter image description here](https://i.stack.imgur.com/kr05b.jpg)

You can tweak the XSL to generate the feed information in a format that you like.
You could enable POP downloading and move/copy your inbox to a local client like Thunderbird. From there the messages will be stored in a flat file that you can access.