kidz55
kidz55

Reputation: 315

getting an email without the history in case of reply

I'm facing a problem with the gmail api,

When I get an email content with the get method by id, in case of replying email, I can't isolate the user response correctly.
for example, here is he body of the email,

A ten, for sure. Photos are great as well as the service! 

Sent from my iPad

On Jul 17, 2017, at 11:32 AM, Steve <[email protected]> wrote:

Hi Patty! 

It would really help us if you could take 10 seconds of your time to rate your experience with Walgreens Photo Print from 0-10 below

012345678910
unsatisfied very satisfied
Thank you for taking the time to let us know what you think. We will use this information to help improve our service!

Have a great day! 

Steve

I would like to isolate the customer response : "A ten, for sure. Photos are great as well as the service!"

But, when I get the body of my email, It seems to be impossible.
Maybe I can do something with threads ?

Upvotes: 1

Views: 72

Answers (1)

payne
payne

Reputation: 14187

The Gmail API does not parse the email contents -- sorting out the reply, the quoted email, the original email, etc. is all up to you.

And given that different email clients may format the reply and quote differently, there's no universal way to do what you want.

Your best bet may be heuristics: for example, "Sent from my iPhone/iPad" is a good hint that the reply has ended. Similarly, Gmail seems to put some div classes in the HTML reply payload that give hints to the reply text and the quoted text.

Upvotes: 1

Related Questions