0
votes

I am looking for ways to slim my gmail account.

E.g. Is it possible to write a script that would do one of the following:

  • remove attachments from quoted text.
  • remove quoted text.
  • replace images in with links to high quality images on my G-drive.
  • perform an arbitrary text operation on previously received emai.

Note I don't want this to happen in the new email: I want do to this on whole folders (labels) of old mail. E.g. open the conversation thread from 2017 with the subject line, "Do you have swedish aspen" and replace each occurrence of 6 pix of SA with links?

1
I don't see anything like that in the GMAIL API Documentation. It looks like the API is mostly read-only.Robert Harvey

1 Answers

1
votes

You could use the API to get old messages, the thing is these messages if they contain attachments, or images, or whatever, they are base64encoded in your mail box.

Now what you are proposing is a kind of reconstruction of your mail box. A way to do something like that would be for example to:

  1. Get all original messages using the Gmail API
  2. Process them with your code
  3. Use the insert method of Gmail API to insert the slimmed messages
  4. Delete the originals using Gmail API

Note:

Using the insert message enables you to preserve the original dates of the messages.


References: