title: Gmail api finding sent item that matches initial draft
body: <p>We have a web application and are looking to integrate it with gmail using the gmail-api's. 
  We also need to do this in such a way that it replicates the functionality our existing email integrations have. The requirement is to be able to create a new draft email from a template, present it in the native UI for that service (in this case in the gmail UI), allow the user to make changes if necessary, and then send it when they are happy with it. Having our own email editor here is not an option the powers are interested in, they want to see it in the gmail UI, and that is how the other integrations work.</p>
  
  <p>So far so simple. Creating the draft was all pretty straightforward. The complication here is we then need to know if the mail actually got sent, get a copy of exactly what was sent and store a copy locally against the audit trail in our application.</p>
  
  <p>What I am struggling with is finding a clean way to track the email between it's draft and sent state.</p>
  
  <p>The problem is that there seems to be no correlation between the draft and the sent mail. When we create the draft via the api, we get a draft data model back for it. I then tried a small test fetching everything in the sent items folder and compared the data returned, but none of the details in the matching sent item could link it back to it's original draft item. The id's, threads, history and headers - none of the values matched.</p>
  
  <p>I tried setting values into header fields, but it looks like just about everything there gets stripped out.</p>
  
  <p>I then experimented with adding labels to the draft, and this seems like it might be a possible way to go, but is feels pretty messy given the need to create unique labels for each mail, and hope the user doesn't remove them. At create time, there is a small overhead of having to check the label is unique, but it's more the polling that really feels messy as you have to fetch all the labels each time as there is no pattern searching which you could group labels into folders.</p>
  
  <p>The last resort option would be to include a BCC field and forward a copy on to another mailbox that is polled periodically. This still doesn't help much with the linking, so we would have to hide/include an identifier somewhere - probably in the email body, and once again hope the user doesn't delete it!</p>
  
  <p>Although I could go with some of the options above, I'm hoping someone will have a simple suggestion for something I have missed or correct any things I have wrongly assumed.</p>
  
  <p>Thanks.</p>