Automating email sending directly from a KNIME workflow

Introduction

Hi, I am Akira, the editor-in-chief of Data Without Code. Over the last few tutorials, we have built the ultimate data machine. You learned how to loop through multiple messy files in a folder, clean them, and combine them into a single, beautiful master report.

But think about your actual morning routine. After the report is generated and saved to your desktop, what do you do next? You open Outlook or Gmail, create a new message, type “Hi team, please find attached the daily report,” attach the file, and hit send.

If you are still doing this manually every day, your automation journey is incomplete. What if I told you that KNIME can write the email, attach the file, and send it to your boss automatically?

In this tutorial, I will show you how to automate email sending directly from a KNIME workflow using the Send Email node.

Meet the Send Email Node

In KNIME, sending an email is treated just like any other data output. Instead of writing data to a CSV file or a database, you are “writing” data to a mail server.

To do this, we use the Send Email node. It acts as a virtual email client that connects to your company’s email server (or your personal Gmail/Outlook account) and sends messages on your behalf.

Step-by-Step: How to Configure the Send Email Node

Before you start, you will need your email provider’s SMTP settings. (SMTP is simply the standard protocol for sending emails). A quick Google search for “Gmail SMTP settings” or “Outlook 365 SMTP settings” will give you the server address and port number.

Step 1: Add and Connect the Node

Search for the Send Email node in your Node Repository and drag it to the very end of your workflow. Usually, you connect it right after your Excel Writer or CSV Writer node so the email only sends after the new report has been successfully saved to your computer.

Step 2: Set Up the SMTP Connection

Double-click the Send Email node. The first tab you see is the Mail Host tab. This is where you connect KNIME to your email account.

  • SMTP Host: Enter your server address (e.g., smtp.gmail.com or smtp.office365.com).
  • Port: Usually 587 or 465.
  • Authentication: Check the box that says “Use Authentication” and type in your email address and password. (Note: For Gmail and Microsoft accounts, you may need to generate an “App Password” in your account security settings instead of using your regular password.)
  • Check the box for STARTTLS or SSL/TLS to ensure your connection is secure.

Step 3: Write Your Message

Go to the Email tab. This looks just like a standard email client.

Fill in the “From” address (your email), the “To” address (your boss or team distribution list), and the “Subject” line. In the main text box, type your message: “Hi team, attached is the latest automated sales report.”

Step 4: Attach Your Automated Report

At the bottom of the Email tab, you will see an “Attachments” section. Click the Add button and browse your computer to find the master report file that your workflow just generated.

Click OK, and press F8 to execute the node. Within seconds, your team will receive the email with the file attached!

Taking Email Automation to the Next Level

Sending a daily report is great, but as a DX manager, I use the Send Email node for much smarter tasks. We call this “Exception Reporting.”

Instead of sending an email every single day, you can use the Rule Engine node to check for specific business conditions. For example, you can tell KNIME: “If inventory for Product X drops below 50 units, trigger the Send Email node to alert the purchasing manager. Otherwise, do nothing.”

And remember our guide on scheduling KNIME workflows? If you combine the Windows Task Scheduler with the Send Email node, your computer will literally wake up at 6:00 AM, build the report, email the team, and go back to sleep before you even arrive at the office.

Conclusion: Your Next Steps

Congratulations! You have now mastered the ultimate end-to-end automation pipeline. From extracting raw data to delivering the final analysis to your stakeholders, you can do it all without writing a single line of code.

But up until now, we have assumed that your data is neatly provided in a file or a database. What happens when the data you need is trapped on a public website, like competitor pricing or stock market tables?

You do not need to copy and paste from your web browser. Join me in our next exciting Automation Hack: How to extract data from a website using KNIME (Web Scraping basics)!

Copied title and URL