# Get Gmail email then forward using gmail node

**URL:** <https://community.n8n.io/t/get-gmail-email-then-forward-using-gmail-node/24862>\
**Category:** Questions\
**Tags:** gmail\
**Created:** [April 5, 2023, 1:51am UTC](https://community.n8n.io/t/get-gmail-email-then-forward-using-gmail-node/24862 "2023-04-05T01:51:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabrielpc1190](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabrielpc1190/32/23543_2.png) [@gabrielpc1190](https://community.n8n.io/u/gabrielpc1190)\
**Post date:** [April 5, 2023, 1:51am UTC](https://community.n8n.io/t/get-gmail-email-then-forward-using-gmail-node/24862/1 "2023-04-05T01:51:37Z")

</div>

## Describe the issue/error/question

I’m trying to download all emails that comply with a specific search pattern, then forward them (by creating a new email) to another address.  
I can get the Gmail node to read the emails, no problem.  
After that one, I add another Gmail node to Send email, but I don’t find a way to add the attachments from the original email into the new one.  
I can see the binaries, but can’t find an expression to add all of them to the new email.  
There could be just one, or two, or three, I never know, but I need to forward all of them.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/d/f/dff184f28599b6008eb0e2bdae935f2246727ac3.png)

## What is the error message (if any)?

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/8/c/8c9971a44653ed959cb1f7e6b713b48ece146817.png)

## Please share the workflow

## Share the output returned by the last node

The output is just 1 item and the error message.  
What I can see on the attachment field is this:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/0/3/0333360383e158c0f2e704f150a9bf58481266a4.png)

## Information on your n8n setup

- **n8n version: 0.220.0**
- **Database you’re using MariaDB:**
- **Running n8n with the execution process [own(default)]:**
- **Running n8n via [Docker]:**

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [April 6, 2023, 1:22pm UTC](https://community.n8n.io/t/get-gmail-email-then-forward-using-gmail-node/24862/2 "2023-04-06T13:22:34Z")

</div>

Hi @gabrielpc1190, the “Attachment Field Name” field would expect just the name of the binary property (or if there are multiple attachments, a comma separated list of these names).

`$binary` would, however, reference the entire dataset. So you probably want to use an expression like `{{ Object.keys($binary).join(',') }}` instead? The [Object.keys method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) would read the names, [.join(‘,’)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join) would return these as a comma separated string.

This seems to work fine for me:

 ![grafik](https://europe1.discourse-cdn.com/n8n/original/3X/a/b/ab721877f74e10e95e9e443d9c4b7200dd86e7bb.png)

---

<div class="post-metadata">

**Author:** ![gabrielpc1190](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabrielpc1190/32/23543_2.png) [@gabrielpc1190](https://community.n8n.io/u/gabrielpc1190)\
**Post date:** [April 10, 2023, 10:44pm UTC](https://community.n8n.io/t/get-gmail-email-then-forward-using-gmail-node/24862/3 "2023-04-10T22:44:02Z")

</div>

Thank you!  
I was away from keyboard because of the hollyweek.  
Will do a test later today and post back the results.

I really appreciate having a community to help with little examples.  
I’m not a programmer, so I’m definitely grateful for any help like yours.

---

<div class="post-metadata">

**Author:** ![gabrielpc1190](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabrielpc1190/32/23543_2.png) [@gabrielpc1190](https://community.n8n.io/u/gabrielpc1190)\
**Post date:** [April 10, 2023, 11:47pm UTC](https://community.n8n.io/t/get-gmail-email-then-forward-using-gmail-node/24862/4 "2023-04-10T23:47:48Z")

</div>

> [@MutedJam](#):
>
> {{ Object.keys($binary).join(‘,’) }}

It works!  
Interestingly on the output there is no binary, but when I check the email sent, it has the binaries!  
Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [April 17, 2023, 11:47pm UTC](https://community.n8n.io/t/get-gmail-email-then-forward-using-gmail-node/24862/5 "2023-04-17T23:47:48Z")

</div>

Closed on April 17, 2023, 11:47pm UTC

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