Extract email addresses from FailingNodeStackTrace Flow Variable

My goal is to find which email address(es) are causing the Send Email node to have errors.

I am attempting to use existing Flow Variables to get this information, but I have run into trouble. The FailingNodeStackTrace flow variable has a very long string value, probably 1000’s of characters, but it has the email address(es) that I need. I wish to return only the email addresses from that long string, and nothing else.

Can someone help me out? I am open to using Python for generating a solution. I attempted a RegEx based solution earlier, but it’s having issues, and I don’t know if that’s because the string is too long or not.

The goal is a complete automation… obviously, I can visually inspect the code and extract the email addresses manually… but the goal is no manual touches.

Do you have a simple example using anonymised data? Event if it is just the string contained in the variable? My first thoughts are that, depending on what the string looks like, a regular expression may do the job here…

org.knime.core.node.InvalidSettingsException: Error while communicating with the smtp server: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 <test123@gmail.com>… User unknown

at org.knime.base.node.util.sendmail.SendMailConfiguration.send(SendMailConfiguration.java:680)
at org.knime.base.node.util.sendmail.SendMailConfiguration.send(SendMailConfiguration.java:659)
at org.knime.base.node.util.sendmail.SendMailNodeModel.execute(SendMailNodeModel.java:95)
at org.knime.core.node.NodeModel.executeModel(NodeModel.java:549)
at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1267)
at org.knime.core.node.Node.execute(Node.java:1041)
at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:595)
at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:98)
at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:201)
at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:117)
at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:367)
at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:221)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)
Caused by: javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 <test123@gmail.com>… User unknown

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:2064)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1286)
at org.knime.base.node.util.sendmail.SendMailConfiguration.sendMail(SendMailConfiguration.java:861)
at org.knime.base.node.util.sendmail.SendMailConfiguration.send(SendMailConfiguration.java:674)
… 15 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 <test123@gmail.com>… User unknown

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1917)
… 18 more

This is the full message. Any of the instances where the <test123@gmail.com> email is referenced are fine to grab. I only need to grab one of them.

Thanks for the example!

I added it to a variable using Contain Input (Variable) to set up an example - after converting to table row I use Regex Split:

split_1 should always contain the email address - am I right in assuming that for each error there is just one Email address included?

The Regex Pattern is this:

(.*<)([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(>.*)

First () matches everything until the <, second () matches any Email address and third () matches anything after >.

I also looked into Regex Extractor, but it looked like its part of Palladian Nodes and needs a paid license (maybe I misinterpreted) - that’s why I stuck with what comes with KAP “out of the box”

2 Likes

That’s for commercial use with KNIME Server/Business Hub. Outside of that you can use without limitation in your AP. It also comes with a pre-defined template for emails.

1 Like

Thanks for clarifying - wow that’s a game changer :slight_smile:

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