Pull text from Gmail

Feb 18, 2019 Last reply: 7 years ago 7 Replies

I have a bunch of Gmail emails from a certain person and would like to import all the text into one text file, sorted in date order. The idea is to get something that I can edit to pull together a mass of technical information in a way that I can quickly consult it.



At the moment the useful material is mixed in with chat about the weather etc.



All I've found so far is a Gmail add-on to convert individual messages to pdf, but nothing that can just grab a lot of emails and pull the text out of all. It seems there used to be a Google labs app that pulled the essential text, without headers etc. to a file, but I can't even find that.



Anyone know of a way to do this?


I think you can download email from gmail using the POP3 protocol.

You could use a POP3 client like fetchmail to download the email and send it to a an MTA for delivery to a local mailbox. You could then parse the local mailbox with the tool of your choice, or write a script to do it.

In message snipped-for-privacy@4ax.com, Caecilius snipped-for-privacy@spamless.invalid writes

Thanks for that.

I used to download Gmail into Thunderbird, but if I can download it into my main mail client, Turnpike, which only does Pop3, I think I can then export as a text file.

I can't remember if Turnpike pop3 settings are global or by server, but be sure to set Turnpike *not* to delete them off the server if you want them kept. I am sure you know this, but it's certainly the sort of slip I could make!

I don't know if it includes the message headers or not, but a couple of sources suggest this add-on and method:

formatting link
formatting link
formatting link
There is also this Chrome add-on, but you need to grant CloudHQ access to your Gmail account to read your messages.

formatting link
Owain

Do have any other mail accounts that you set-up using another email client (Turnpike)?

If so just forward your Gmail emails to this other email address and export them as plain text in your alternative email client.

On my smartphone a gmail email has a reply, reply all and a forward option at the bottom of the screen when viewing the individual email.

Not sure about POP3 but IMAP4 is supported for sure - and same range of solutions apply :)

You could probably use Thunderbird, then bulk select and copy to a Thunderbird local (to PC) folder, then you'd have an mbox style file.

Beware though - having just implemented an email parser, it can be nightmarish as even the "text" bit can be buried 1-2 levels deep in nested MIME!

You could merge and edit the PDFs. Or copy the required text from the PDFs into a text file.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required