Multiple attachments when sending to email

Hello everyone!
Please help

  1. I can’t send one message with multiple attachments, attachments are sent by path (variables). How can this be done?
    What I could do is only through loop , but it sends each attachment separately

  2. the problem is not critical, but is there a solution: If I send a file with a long name, the name is corrupted (example of corrupted file name: =UTF-8Q=D0=D0=D0=D0=D0=94=D0=D0=D0=D0=D0=B0=D0=BD=D0=BD=BD=BD=D1=8B…xlsx= ).

1 Like

Hi @greenhero4 ,
from my understanding of the case you are referring to and the screenshot you have provided, this is the expected behavior:

  • The start of your Loop - Table Row To Variable Loop Start – KNIME Community Hub - uses each row, one by one, of an input data table to define new variable values for each loop iteration.

  • Hence, in the first iteration, the first row - first attachment’s path in your table - will be chosen as a value for your flow variable. In the next loop iteration your flow variable value will be overwritten with the next row, i.e. with the next attachment’s path.

  • In each loop iteration Send Email node will be executed and will actually send an email, with the attachment of the currently chosen path. The settings of the nodes in inside of the loop body are overwritten with each iteration.

Is it possible to send multiple attachments and pass their paths as a flow variable? Yes :slightly_smiling_face:

In a nutshell, you would need to have flow variable type array, listing all attachments. You then select it in the Send Email node and you would not need to loop over it.

My colleague @armingrudd explains it very well in this forum thread.

Hope it helps!
Best,
Daria

3 Likes

Generic Email 365.knwf (43.2 KB)

Here is a basic loop that I use to get around email send errors caused by missing data in each flow variable. It also uses a “Create Collection Column” to combine multiple attachments into the same flow variable. The loop in this is designed to distribute to multiple email addresses with each utilizing customized attachments, text and recipients.

You just need to put your credential info into each of the Send Email nodes and replace the Attachment / Email addresses in the Table Creator with your own info to test it.

2 Likes