How to pull gmail body text?

Describe the issue/error/question

how do i get the body of the email to display on the trigger or with Get Gmail? i only see snippet

What is the error message (if any)?

none

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: .220
  • Database you’re using (default: SQLite): SQlite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker

Hi there,

You can try to disable the “Simplify” option to get the raw data.

image

Here is an example:

Best,

Romain

1 Like

Hello, to continue this thread, I’m wondering how can we manage the data, here’s my usecase :

image

I’m using the “text” from the Trigger Gmail Node, I’m wondering how can I extract data like : email, téléphone (phone), type de contrat (contract type), date de naissance (birth day) etc…

Are you guys thinking of a way to extract this data ? Maybe it’s better to use the “HTML text” ?

Thanks for your help :slight_smile:

Hi, I don’t know if you found a solution but if it’s not the case you can use Regex.
That’s not simple but there are some generator online like https://regex101.com.

Here is my case for example.
I forward some mails to an email address reserved for n8n to do some automation. I need to retrieve the sender email address but it’s a forward so the sender is me… The real sender address is in the body like this:
Capture d'écran 2023-06-06 011345

To get the “[email protected]”, I use this in the next node:

{{ $json.From.match(/[\w.-]+@[\w.-]+\.[A-Za-z]{2,}/)[0] }}

Example here in the Notion node:
Capture d'écran 2023-06-06 013259

(You can put /[\w.-]+@[\w.-]+\.[A-Za-z]{2,}/ in the regex101 website, it will explain what every part does).

This Regex seeks all the “@” characters and return it with what is before and after. The [0] at the end is to get the first occurence (if there is multiple results, change this number to get the others).

In my case, I could just as easily have used /<([^>]+)>/g that simply seeks what is between “<” and “>”. But my first Regex can suit your case !

For the phone you can use /^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/ that seeks all the phone numbers that starts with +33, 033 or 0 (like 01, 06,…), with spaces or no spaces between numbers.
The contract type can be /type de contrat\s*:\s*(\w+)/i.
And the birth date /^(\d{2})\/(\d{2})\/(\d{4})$/.

Note that I’m not a Regex expert and there are maybe some errors…

Hope that it can help ! Bonne soirée ! :smiley:

Hello, thanks for the tips ! This is really useful, I’ll maybe can do other things now.

Here’s how I solve my first problem (to get the phone number)

I’ll train myself on the website now.

Have a nice day :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.