Attach 2 or more files to mail

Hi,
I need to attach in a mail two files to an email and these two files come from 2 different paths.

I tried to insert in the field “Attachment” in send mail Activity:
FILE1+“,”+FILE2 ,

where FILE1 and FILE2 are variable with inside the path of the files. I also tried to create an array:
[FILE1+“,”+FILE2]
same error

Hello @daniele_arcangeli,

This article of the help center might be helpful for you:

It explains that to specify several files to be attached, use the following format of the path (in the “Calculate a value” option):
Example:
["C:\\Users\\ElectroNeek\\Desktop\\attachment\\request.neek","C:\\Users\\ElectroNeek\\Desktop\\attachment\\main.neek"]

3 Likes

Thanks Renan, that’s exactly what I did but instead of writing the full path I take it from the variables.
Outlook: The specified path format is not supported.

1 Like

Looks like the variables contain an invalid path format. Can you show the content of the variables?

2 Likes


Hey @cris-dsc , this is my test code, I inserted two txt files that should attach me to the email.
In production environment variables will not be test1/test2 but will be with equivalent value (string path format).
I have used the attachment function with one variable and it has always worked. I have attached multiple files with “add directory” but in this case the files reside in two different folders…

Hi @daniele_arcangeli

Can you try this please:

var test1 = "var 1";
var test2 = "var 2";

var array = [test1,test2]

image

Output should be:
console.log(array);
["var1", "var2"]

You don’t need to concatenate both variables, only separate them with commas.
Hope this helps

3 Likes

Hello @daniele_arcangeli,

did you try just to use
[FILE1,FILE2]
?

Regards,
Mikhail

Thanks everyone, this is the solution to the problem

initialize an array and push the two paths into it

1 Like