# Loop on collections in the email body

**URL:** <https://community.make.com/t/loop-on-collections-in-the-email-body/65680>\
**Category:** Questions\
**Tags:** arrays, mapping\
**Created:** [January 7, 2025, 8:38am UTC](https://community.make.com/t/loop-on-collections-in-the-email-body/65680 "2025-01-07T08:38:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hicham1](https://avatars.discourse-cdn.com/v4/letter/h/a698b9/32.png) [@Hicham1](https://community.make.com/u/Hicham1)\
**Post date:** [January 7, 2025, 8:38am UTC](https://community.make.com/t/loop-on-collections-in-the-email-body/65680/1 "2025-01-07T08:38:50Z")

</div>

Hi Everybody!

I need to do a loop on an array of collection in the body of my email.

Here my data recieved in the webhook :  
{  
“email”: [  
“[my\_email@gmail.com](mailto:my_email@gmail.com)”  
],  
“mail\_type”: “portability\_request\_rejected\_fr”,  
“portability\_desired\_date”: “25/11/2024”,  
“portability\_reference”: “PIN202501020005425”,  
“portability\_rejected\_reason”: [  
{  
“reason”: “Problème avec le mandat”,  
“details”: “Le mandat n’est pas signé”  
},  
{  
“reason”: “Problème avec la pièce justificative”,  
“details”: “La pièce fournie ne contient pas le numéro de téléphone que vous souhaitez porter.”  
}  
]  
}

In the body of my email i try to do this :

map({{1.portability\_rejected\_reason}}; reason)

This works, but I need to display both the `reason` and `details`. However, I can’t display both attributes of my collection on the same row.

Do you have any ideas, please?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Hicham1](https://avatars.discourse-cdn.com/v4/letter/h/a698b9/32.png) [@Hicham1](https://community.make.com/u/Hicham1)\
**Post date:** [January 9, 2025, 8:26am UTC](https://community.make.com/t/loop-on-collections-in-the-email-body/65680/2 "2025-01-09T08:26:20Z")

</div>

I finally succeeded. It was necessary to use an Iterator connected to the original collection array and then add a Text Aggregator module to specify the desired output format. In my case:

```auto
<tr>
    <td>{{2.iterator:number}}</td>
    <td>{{2.iterator:ndi}}</td>
    <td>{{2.iterator:rio}}</td>
    <td>{{2.iterator:analogic}}</td>
</tr>

```

Then, in the email-sending module, within the email body, I simply referenced my Text Aggregator like this:

```auto
<html>
    <body>
        <table>
            <tr>
                  <th>NUMBER</th>
                  <th>NDI</th>
                  <th>RIO</th>
                  <th>ANALOGIC</th>
           </tr>
           {{3.TextAgregator}}
        </table>
    </body>
</html>

```

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [January 23, 2025, 11:25am UTC](https://community.make.com/t/loop-on-collections-in-the-email-body/65680/3 "2025-01-23T11:25:28Z")

</div>


