user3787910
user3787910

Reputation: 313

Is it possible to use "attachment id" of different email thread in a new email?

In my Chrome plugin, I'm composing a new email with a user selected attachment from an existing email. I would like to avoid downloading and uploading the attachment and instead use the existing "attachment id" in the new email. Before I spent few days researching, I would like to know whether this is possible to do.

Thank you.

Upvotes: 0

Views: 612

Answers (1)

sameerkn
sameerkn

Reputation: 2259

First, an attachment is inherent part of an email. Its like a block of characters in the complete email. Although, it has an ID but this ID is unique in the corresponding email only, the email in which it is present.

The thing which you are trying to achieve is possible in following scenarios:

  1. If all the attachments are extracted from an email and stored on some public accessible storage with unique ID inside storage, then you can simple put a link of an attachment (which is selected by the user) from the storage. Extraction and storing of attachments can happen when a email is received in an account on the server.
  2. You can store some kind of mapping [email-identifier, attachment-identifier] in some database on server side where all the emails of an account are accessible. When a user select an attachment from a particular email then, you know which email is selected (email-identifier) and which attachment inside that email (attachment-identifier) is chosen. Now, you can simply pass [email-identifier, attachment-identifier] mapping to server. Then, on server you can easily locate the email with (email-identifier) and then extract the attachment (with attachment-identifier) and then attach that extracted attachment in the new mail. Note that in this approach you will be required to extract attachment from old mail and then attach the same in new mail since as told initially that attachment is embedded in the email. Also note that you will be required to assign unique identifiers to all the emails inside an account.

Therefore, if there are APIs available inside gmailAPIs which can help you in accessing a particular attachments inside a particular email then method 2 is possible.

If something is unclear or need to proceed with some implementation then please revert here.

Upvotes: 1

Related Questions