How to send dynamic email attachments?

Hi there,

Anyone know how to send out dynamic email attachments? I have automated a report I work on daily; however, this reports has a time stamp as part of the naming convention, as such, I’d need some sort of flow variable to change the changing path of the file. I read on other posts that typing in File:/a would work, I have tried it and I am not seeing it under the Flow Variables option.I am attaching a screenshot of my work flow and what I have done.

Thank you all!

Hi there @etorres,

you should create a flow variable type array that will hold URLs pointing to files you want to send as attachments. This flow variable then choose as attachedURLs value.

If your attachments are all in same folder you can use following logic to obtain flow variable type array:

URLsAsFVArray

Br,
Ivan

6 Likes

@ipazin,

Thank you for the help it works. Also, I keep receiving the emails on the junk folder. I tried changing the junk functions, added to allowed emails and not junk options and still the messages are being received onto the Junk Email options. Any other way we can address this? Or, is this something the IT at my office will have to fix?

Thanks,

Hi @etorres,

glad it works!

Regarding emails in junk - as you said don’t think it is KNIME related. Check with IT :wink:

Br,
Ivan

2 Likes

@ipazin

Thank you so much!

Hi,
I´m using the node to send email through a cycle, in this cycle i group the individuals by the entity to wich they belong, wich is why i can have more than one variable attachment by mail.
How can i attach n files according to the iteration?
For example, an iteration can have only one individual (only one attachment), and the netx iteration can have two inidividuals(two attachments).

hi @daviddelos,

well in each iteration you will create flow variable with URLs pointing to file(s) you want to send as attachment(s). You need to create logic that will based on entity create appropriate flow variable in each iteration.

Br,
Ivan

Hi @ipazin
Thanks for the answer, but, can you be more especific please?
I get groups for entity, for each entity i´m sending one email with variable number of attachments, how can a i make this (Send email) node take this n variables?

Hi @daviddelos,

sure I can but can you give me some data? Those groups with entities you get and explain your process a bit more like where are attachments you want to send and do you need to apply some logic based on entity/group or you have defined which files go for which entity/group…

Br,
Ivan

I have this:
1

I using the GroupBy for group only the cases of each entity. After of this, i using a cell spliter for get the files path in the same row, so this result seen like this :
2

Then I use the table row to variable loop start and start to take de rows sending the email for entity:
3
But, this workflow only would works for cases in than only be a two attachment, can be cases than i have n files to attach, which would be reflected with the cell splitter shown above, as new columns, so despite entering as variables to the email node, in this I can not find a way to configure them regardless of the number that are…
4
Do you have any idea how I could do it?

Hi @ipazin

Was it clear to you what my doubt is with the screenshots of the workflow I showed you?

Hi there @daviddelos,

yep. It is pretty clear. So first I noticed you have a different Flow Variables tab in Send Email node which probably indicates you don’t have newest KNIME version as new flow variable types are available from 4.1.0. so I suggest to update. Here is how I did it using new flow variable type Collection/List:

Basically you create list of files in GroupBy node. Then you take row by row with Chunk Loop Start (similar to Table Row to Variable Loop Start but haven’t used it cause it is not supporting new flow variable types, yet) and then inside loop create flow variable which I use in Send Email node:

Here is workflow on KNIME Hub so you can explore it:


Hope this helps!

Br,
Ivan

@ipazin Thank so much!!
After to actualice mi Knime version, it works like you explain it.

However, I have a problem for other types of variable attachments. in the olds version of Knime than i had, i could adjunt more than one attachment like variable, just like seen here:

image

If i put file:/test in the attachment configuration window, in the flow variables showme as many options as “file: / test” I put, like this:
image

Do you know if in version 4.1.1 of knime this is also possible?

1 Like

Hi there @daviddelos,

glad it works now. Don’t think it is possible to have multiple options for attachments as used to be. But can’t you have all attachments in one collection flow variable?

Br,
Ivan

Hi @ipazin ,
I had several files that came from different parts of the flow, that is, both the n files that came in the same column, and another file that I also send per entity, and that came in another column from another part of the flow, like this:
image

However, I found the way to have all url attachments in the same column, and then with what you taught me to list them in the send email node, I could do it without problem

Thank you very much for your help,
It really helped me a lot what you told me

1 Like

Hi @daviddelos,

glad I helped :wink:

Br,
Ivan

Can I send dynamic email attachments from my arvig web mail account? Is it safe?

Hi there @victoria1,

welcome to KNIME Community!

If you can send attachments from it then you can configure KNIME workflow to send dynamic ones cause I don’t think they (dynamic attachments) affect safety in any way :wink: What are you concerns?

Br,
Ivan

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.