Question
I want to send a batch of files to a user upon clicking a button (selecting specific files based on a condition). And here it's a bit unclear: should I use a list or an associative array? If it's an associative array, then according to the official documentation (maybe I misunderstood), I need to extract a list of file names from the database, place them in the field field in rowCreate, and then match them to the list of names that will be used to label the files in the email. How can I do this?
Answer
If all the necessary files are in one field, you can send them by passing the contents of this field to the files
parameter:
=: emailSend(to: "your_email@gmail.com"; title: "test title"; body: "email with files"; files: #file)
If the files are in several rows, you need to take them through selectList and concatenate them into one list using listTrain:
=: emailSend(to: "your_email@gmail.com"; title: "test title"; body: "email with files"; files: $files)
files: listTrain(list: $list)
list: selectlist(table: 'some_table'; field: 'file'; where: 'type' = "some_value")