I'm try to send email with  smtp.libero.it  server with superbasic code
Obviously the username and password are fictitious
B4J 10.0
JNET library 1.81
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The following error is always returned on the line "Wait For (smtp.Send) SMTP_MessageSent (Success As Boolean)"
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
If I try to use the same data to send using Swithmail, sending is correct, and therefore even if the port used is 587 instead of 465 I imagine that the data used is correct
What could the error I receive depend on?
			
			Obviously the username and password are fictitious
B4J 10.0
JNET library 1.81
			
				B4X:
			
		
		
		Dim smtp As SMTP
    smtp.Initialize("smtp.libero.it","587","[email protected]","password", "SMTP")
 
    Dim destinatari As String = "[email protected], [email protected]"
    Dim destinatari_array() As String = Regex.Split(",", destinatari.Trim)
    For Each email As String In destinatari_array
        smtp.To.Add(email.Trim)
        Next
    smtp.UseSSL = True
    smtp.StartTLSMode=True
 
    smtp.Sender = "[email protected]"
    smtp.AuthMethod = smtp.AUTH_LOGIN
    smtp.HtmlBody = True
    smtp.Subject = "Oggetto email inviata"
    smtp.Body = "Corpo dell'email inviata"
 
    Wait For (smtp.Send) SMTP_MessageSent (Success As Boolean)
    If Success Then
        Log("Message sent successfully")
    Else
        Log("Error sending message")
        Log(LastException)
    End IfThe following error is always returned on the line "Wait For (smtp.Send) SMTP_MessageSent (Success As Boolean)"
			
				B4X:
			
		
		
		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(Alert.java:131)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:325)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:268)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:645)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:464)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:360)
    at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
    at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:445)
    at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:423)
    at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
    at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:167)
    at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1462)
    at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1370)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:437)
    at org.apache.commons.net.smtp.AuthenticatingSMTPClient.performSSLNegotiation(AuthenticatingSMTPClient.java:284)
    at org.apache.commons.net.smtp.AuthenticatingSMTPClient.execTLS(AuthenticatingSMTPClient.java:264)
    at anywheresoftware.b4a.net.SMTPWrapper$1.run(SMTPWrapper.java:267)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)
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(PKIXValidator.java:439)
    at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
    at java.base/sun.security.validator.Validator.validate(Validator.java:264)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
    at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
    at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:629)
    ... 18 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(SunCertPathBuilder.java:141)
    at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
    at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
    at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
    ... 23 moreIf I try to use the same data to send using Swithmail, sending is correct, and therefore even if the port used is 587 instead of 465 I imagine that the data used is correct
What could the error I receive depend on?
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		