1

I am playing around with the GMail API and can now fetch the message body from a returned message resource.

Now I am interested in how I can strip off the signature from that body, e.g. when I only want to return the text of the mail someone wrote, but not the signature many people have automatically attached from google in every mail.

For example:

// The actual message
Dear Sir,

here is an E-Mail for you.
Cheers

// Signature
John Doe
CEO of SuperDuper Inc.
SuperDuperStreet 200
New York City

I have not found anything regarding this in the documentation. Is the signature delivered in its own field or unsplittable attached to the message itself?

ffritz
  • 2,180
  • 1
  • 28
  • 64
  • The signature is a part of the message, and is not in a separate field, sadly. Are you trying to extract the signature from a `html` part? Then you can find the signature within the `
    ` element.
    – Tholle Sep 30 '17 at 16:13
  • 1
    @Tholle Yes I need to strip off the signature, good idea with just removing the div with the signature class. Thanks! – ffritz Sep 30 '17 at 16:15
  • You may want to also try adding some filters as suggested in this [SO post](https://stackoverflow.com/a/2193937/6092067) and see if it will help you. – Teyam Sep 30 '17 at 19:29

0 Answers0