Sherwood Botsford
Sherwood Botsford

Reputation: 1997

Does the gmail api allow editing of existing email?

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:

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?

Upvotes: 0

Views: 251

Answers (1)

Aerials
Aerials

Reputation: 4419

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:

Upvotes: 1

Related Questions