How to use the "send mail" node?

Hi all,

My “send mail” node cannot work. Is there any wrong about my setting?
really confuse…

Knime console shows the following info:

ERROR Send Email 4:5 Execute failed: Couldn’t connect to host, port: smtp.gmail.com, 465; timeout 15000, try adjusting the smtp timeout settings

But when I adjust the smtp timeout settings, it’s showed…

ERROR Send Email 4:5 Execute failed: Couldn’t connect to host, port: smtp.gmail.com, 465; timeout 15000, try adjusting the smtp timeout settings

My setting for mail host (SMTP)
SM TP Host: smtp.gmail.com
SM TP Port: 587

Hello @Lee_Po4 ,

have a look at this:

But if I am not wrong, access through “Less secure apps” is not available anymore with Gmail.

Try with another provider. I use outlook, and it works.

Have a nice day,
Raffaello Barri
LinkedIn

1 Like

Hello @lelloba ,
instead of your regular password you can use an App password. Please follow this instruction to create a new App password.
Once created use the App password instead of your standard password in the password field as shown here:

Bye
Tobias

2 Likes

Nice @tobias.koetter! Thank you :slight_smile:

Raffaello

Hi Tobias,

Thanks for this. Unfortunately, when I try this the Send Email node fails with the error message:

ERROR Send Email 3:1 Execute failed: Error while communicating with the smtp server: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

The version in the KNIME Log is longer but not much more (if any!) informative:

2024-01-24 17:28:46,493 : ERROR : KNIME-Worker-15-Send Email 3:1 :  : Node : Send Email : 3:1 : Execute failed: Error while communicating with the smtp server: javax.mail.MessagingException: Could not convert socket to TLS;
  nested exception is:
	javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
org.knime.core.node.InvalidSettingsException: Error while communicating with the smtp server: javax.mail.MessagingException: Could not convert socket to TLS;
  nested exception is:
	javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	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.MessagingException: Could not convert socket to TLS;
  nested exception is:
	javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2140)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:734)
	at javax.mail.Service.connect(Service.java:342)
	at javax.mail.Service.connect(Service.java:222)
	at javax.mail.Service.connect(Service.java:243)
	at org.knime.base.node.util.sendmail.SendMailConfiguration.sendMail(SendMailConfiguration.java:856)
	at org.knime.base.node.util.sendmail.SendMailConfiguration.send(SendMailConfiguration.java:674)
	... 15 more
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
	at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
	at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
	at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
	at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(Unknown Source)
	at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(Unknown Source)
	at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(Unknown Source)
	at java.base/sun.security.ssl.SSLHandshake.consume(Unknown Source)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(Unknown Source)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(Unknown Source)
	at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
	at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:602)
	at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:529)
	at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:2135)
	... 21 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.validator.PKIXValidator.doBuild(Unknown Source)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
	at java.base/sun.security.validator.Validator.validate(Unknown Source)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
	... 36 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
	at java.base/java.security.cert.CertPathBuilder.build(Unknown Source)
	... 41 more

Steve

Hello @lelloba ,

It seems like there might be an issue with your SMTP settings for the “Send Email” node. Please check the following settings:

SMTP Host:
Ensure that the SMTP host is set to “smtp.com” without any extra characters or spaces.

SMTP Port:
Use port 587 for TLS or port 465 for SSL. In your case, it seems you’ve set it to 587, which is correct.

From Email:
Make sure you’ve provided a valid email address in the “From Email” field.

User Name and Password:
Check if the username and password for your Gmail account are correctly entered.
Ensure there are no typos or spaces.

Hello @tqAkshay95 ,

did you mean to tag @Lee_Po4?

Have a nice day,
Raffaello

Hello @lelloba,

Yes, actually I intended to tag @Lee_Po4.

Have a nice day,

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