0

I'm working on a collaboration tool and I need the ability for the sender to add a label as defined by the recipient to an email.

I'm using a combination of InboxSDK within a Chrome Extension and a backend Rails application that talks to the Gmail API.

From what I can tell though, the Gmail message id is different for the sender and the recipient. So if the sender flags the message as relating to a label that the two have agreed upon, I can't see a way to programmatically label the message for the recipient.

Is there a unique identifier in a Gmail message that I could use as the key for both sender and recipient?

I've considered creating a hash of the email based on metadata and body, but was hoping someone might have some insight into how to make this connection between sender and recipient.

brianrhea
  • 3,674
  • 3
  • 34
  • 57

1 Answers1

0

A Gmail mailbox label is the domain of the mailbox owner and can't be specified by the sender.

The sender can, however, add extra headers to the message. By convention, headers that begin with X- are "private" and are (generally) ignored by the mail transport agents.

So, your sender could add the header:

X-Private-Information:  rt45ggx45t

Of course, the header payload can be anything, as long as it meets the formatting requirements for email headers.

As an example, here are some headers for an email sent recently by Make magazine:

Received: by mailer.inboxpartner.com id hapk2e28 for <andy@xxx.yyy.zzz>; Wed, 10 Jan 2018 19:23:10 +0000 (envelope-from <noreply@mailer.inboxpartner.com>)
Date: Wed, 10 Jan 2018 19:23:02 +0000
To: "andy@xxx.yyy.zzz" <andy@xxx.yyy.zzz>
From: "Make: magazine" <noreply@mailer.inboxpartner.com>
Reply-To: "Make: magazine" <noreply@mailer.inboxpartner.com>
Subject: Your Make: Vol. 61 Digital Edition is Here!
x-track-version: 4
x-track-source: notifire_bluetoad
x-track-spooler-id: 39466
x-track-spooler-split-id: 39508
x-track-spooler-segment-id: 70820
x-render: pmta-4-003

For some additional context, see: What do X-headers in mails stand for?

payne
  • 13,833
  • 5
  • 42
  • 49
  • This is a really great suggestion. However, the user will be sending the email from Gmail in the web browser and so even with a Chrome Extension in place to intercept some events, I don't think I'll be able to add an X-header to the email. – brianrhea Jan 12 '18 at 03:49
  • Ah, understood. Consider updating your question with this detail (it was tagged as "gmail-api", so I assumed that was used for sending)? – payne Jan 12 '18 at 17:38