Problems with what you tried so far
the Rules Action to Send Email is in a Rules loop, and I get one email per item in list
Your rule works as implemented: for each iteration of your loop, you have a Send an eMail action ... That's not really what you want of course ...
When I move Send Email to the left, I cannot access the "list_item
" variable.
With that "move Email to the left", you must mean something like "Using the Rules UI, I change the Rules Action to Send an eMail, so that it is no longer considered as one of the Rules Actions to be performed for each iteration of the loop. And instead that Send an eMail Rules Action should only be performed 1 time after the Rules loop is completed finished".
So yes, that's a way to only execute such Send an eMail Rules Action 1 time (instead of for each iteration of the loop). However, by doing so, your Rules Action to Send an eMail no longer has access to that crucial variable list_item
which is like a local variable inside your loop.
Solution to make it work anyway
However, if what you're looking for (= the list of files as stored in your file field) is not available, then just (a) make it available first and (b) wait with your Send an eMail action until it is available. Read on for more details ...
The trick to do so is similar to what is shown in the Rules example included in my answer to "How to concatenate all token values of a list in a single field within a Rules loop?". In your case, you could make it work like so:
- Add some new Rules variable that will be used later on as part of the eMail body, before the start of your loop. Say you name the variable
file_list_var_for_email_body
.
- Within your loop, for each iteration, prepend or append the value for each
list_item
to that variable file_list_var_for_email_body
(see where we're going???).
- Move that Send an eMail action outside your loop, and after the loop completed. And finetune the details (configuration) of your Rules Action to Send an eMail. When doing so, you'll be able to select the token for
file_list_var_for_email_body
to include anywhere in your eMail body.
Easy, no?