Send Email to users from Table with content from table

Hi everyone,

I want to use knime to send an email to multiple users listed in a table. The same table has other columns which represent the user-individual content of the email I want to send.

The Table would look something like this:
Example_file.xlsx (11.1 KB)

I am fairly new to knime and I am not really shure how to start with this problem.

Has someone an idea? Thank you very much for your help.

Best Ole

Hi Ole,
I would use a Table Row To Variable Loop Start to loop through your table. Then you add a Send Email node after that. In the send email node you have access to the current row’s content via Flow Variables. The flow variable for the body you can directly use inside the corresponding text box, the one for the “to” field must be set in the Flow Variables tab of the configuration. It might be necessary to add a dummy value in the “to” text field in the “Mail” tab so the dialog’s validation runs through.
Finally, you will need to close your loop. You can do that by just appending a Variable Loop End node to the Send Mail node. For that, right-click the Send Mail node and choose “Show Flow Variable Ports”, then connect the top-right red dot to the red dot of the loop end.
Kind regards,
Alexander

3 Likes

Hi Alexander,

thank you very much. I have build a worklflow according to your explanations. I get the error “Error while communicating with the smtp server: javax.mail.messagingException: [EOF]” I am using Office 365 and used smtp.office365.com as SMTP Host and 587 as SMTP port. Do you have an idea what I did wrong here?

Also one further question regarding this configuration. Is it possible to adjust it such that only one email for every unique adress is send with an aggregation of all content rows that are mapped to this e-mail?

Again thank you very much for your help!

Best Ole

1 Like

Hi Ole,
Unfortunately I cannot say what is wrong with the SMTP-Connection. Maybe the wrong TLS-Settings? EOF stands for “End of File”, so the server ends its message before the clients expects it.

Regarding the configuration: Before the Loop Start, you can aggregate your data with the GroupBy node. Choose the recipient as the group column and then go to the “Manual Aggregation” tab and double-click your email-body column. It will show up on the right and there you can click on the Aggregation type (“First” by default) and change it to “Concatenate”. At the bottom of the config you can define the separator for concatenation, it is comma by default, but if you want a new line instead, you can enter “\n” (without quotes).
Kind regards,
Alexander

2 Likes

Hi Alexander,

thank you so much for your help. This is a great soultion to my problem!

Best Ole

1 Like

Take a look at this workflow as well. It is set up for 365, it has a key switch built into it to avoid errors when things like attachments see cc or bcc‘s are missing. It may also help you see the formatting that is required for the node.

You may need to open up firewall ports on your PC to KNIME as well if it is being blocked.

2 Likes

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