Send repeater data via email ?

Hello,

I’m trying to send emails through a custom form that would also take the data (all the titles and quantities for example) of my repeater.

I can send an email with some variables but I can’t figure out how to also add the data of each line of the repeater in some sort of list in the email…

variables: {
            name: $w("#name").value,
            lastname: $w("#lastname").value,
            emailContent: $w("#emailContent").value,
            repeater1: arrayItems[0].title, // I have only the title of the first line. How to have each line ?
          },

I think a could add this below :

repeater1_title1: arrayItems[0].title,
repeater1_title2: arrayItems[1].title,
repeater1_title3: arrayItems[3].title,
etc...

and in my email :

${repeater1_title1}
${repeater1_title2}
${repeater1_title3}

but it’s not great and some variables could be empty in my email…

And when I try to send the whole repeater data (array of objects), the email is not sent… I think I need “string” values for my variables in the email.

repeater1: arrayItems, // This doesn't work... The email is not sent.

Has anyone tried that before ? How can I send the data of a repeater via email ?

Many thanks in advance for your help ! :grinning:

@costino80 Did you ever figure this out? I have the exact same task you need to do.

I have a list of items in a repeater and I’d like to convert that list to format to email.

The list amount could be different each time so the number of results all need to output to the email like you needed to. Any feedback or tips would be very helpful.

Hello.
What I ended doing is convert my array into a string. So my list of quantities for example would be on the same line like 54, 32, 85.
So in my email I send the products on a line and the quantities on the other line.
Example :
chair 1, chair2, chair 3
54, 32, 85

I didn’t find a solution to send anything else than strings, even though columns and lists would have been nicer :wink:

Part of my code :

export function itemQuantity_change(event) {
let arrayInput=[];
 $w("#repeaterUserSelection").forEachItem( ($item, itemData, index) => {
 let repeatedElement = $item("#itemQuantity").value;
 // I create an array when the user change or add an input
  arrayInput.push(repeatedElement)
  });
 var quantities = arrayInput.map(function (item) {
  return item});
 // I convert my array into a string to be used as a simple variable in the mail
 let quantitiesList = quantities.toString();
}

I hope it will help. Good luck ! :grinning:

1 Like

@costino80 Thank you so much for replying. This is the most information i’ve found on wix related to this subject so I will try to do something similar to what you provided. Thank you again for giving your time to reply!

@irvingdesignui Great ! I’ll hope you find a solution to your problem :wink: