EmailProfileManager send email / com.sun.mail.util.MailConnectException

Ignition 8.1.51

I use the following code to send email from a module,
from Config>Network>Email Profiles test it's ok the email is well send and I received it,
but from the code I have the following error:
(profile Classic SMTP)

Do I missed something or used a wrong parameter :face_with_monocle:

(gatewayContext.getEmailProfileManager().getProfile(email_emailProfileName).isPresent()){
                EmailMessage emailMessage = EmailMessage.builder()
                        .setFrom(this.email_fromAddress)
                        .setSubject(subject)
                        .setBody(messageEscape)
                        .setContentType(contentType)
                        .setToRecipients(toRecipients)
                        .setCcRecipients(ccRecipients)
                        .setBccRecipients(bccRecipients)
                        .setAttachNames(attachNames)
                        .setAttachData(attachData)
                        .setTimeout(this.email_retryDelaySec)
                        .setRetries(this.email_retryCount)
                        .setPriority(priority)
                        .setReplyTo(replyTo)
                        .build();

                logger.info("emailMessage = {}",emailMessage.toString());
                gatewayContext.getEmailProfileManager().getProfile(email_emailProfileName).get().sendEmail(emailMessage);

Exception on sendEmail

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.smtp2go.com, 25; timeout 60
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:195)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendMailWithRetries(AbstractSmtpEmailProfile.java:289)
at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.doSendEmail(AbstractSmtpEmailProfile.java:259)
at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendEmail(AbstractSmtpEmailProfile.java:72)
at com.inductiveautomation.ignition.gateway.mail.EmailProfileManagerImpl$RunningEmailProfile.sendEmail(EmailProfileManagerImpl.java:455)
at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.sendEmailToProfile(NotificationManager.java:1120)
at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.lambda$sendEmail$0(NotificationManager.java:1034)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Connect timed out
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:357)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2175)

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.smtp2go.com, 25; timeout 60
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:195)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendMailWithRetries(AbstractSmtpEmailProfile.java:289)
at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.doSendEmail(AbstractSmtpEmailProfile.java:259)
at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendEmail(AbstractSmtpEmailProfile.java:72)
at com.inductiveautomation.ignition.gateway.mail.EmailProfileManagerImpl$RunningEmailProfile.sendEmail(EmailProfileManagerImpl.java:455)
at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.sendEmailToProfile(NotificationManager.java:1120)
at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.lambda$sendEmail$0(NotificationManager.java:1034)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Connect timed out
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
at java.base/java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:357)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2175)

INFO   | jvm 1    | 2025/12/19 19:27:13 | DEBUG: setDebug: JavaMail version 1.6.2
INFO   | jvm 1    | 2025/12/19 19:27:13 | DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
INFO   | jvm 1    | 2025/12/19 19:27:13 | DEBUG SMTP: need username and password for authentication
INFO   | jvm 1    | 2025/12/19 19:27:13 | DEBUG SMTP: protocolConnect returning false, host=mail.smtp2go.com, user=*********, password=<null>
INFO   | jvm 1    | 2025/12/19 19:27:13 | DEBUG SMTP: useEhlo true, useAuth true
INFO   | jvm 1    | 2025/12/19 19:27:13 | DEBUG SMTP: trying to connect to host "mail.smtp2go.com", port 25, isSSL false
INFO   | jvm 1    | 2025/12/19 19:27:13 | W [g.EmailProfile                ] [19:27:13.303]: Email with subject Ignition Alarm Notification could not be sent to one or more recipients. Will retry 3 more time(s). name=emailProfile, id=1, type=smtp.classic
INFO   | jvm 1    | 2025/12/19 19:27:13 | com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.smtp2go.com, 25; timeout 60
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at javax.mail.Service.connect(Service.java:388)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at javax.mail.Service.connect(Service.java:246)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at javax.mail.Service.connect(Service.java:195)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at javax.mail.Transport.send0(Transport.java:254)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at javax.mail.Transport.send(Transport.java:124)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendMailWithRetries(AbstractSmtpEmailProfile.java:289)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.doSendEmail(AbstractSmtpEmailProfile.java:259)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendEmail(AbstractSmtpEmailProfile.java:72)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.inductiveautomation.ignition.gateway.mail.EmailProfileManagerImpl$RunningEmailProfile.sendEmail(EmailProfileManagerImpl.java:455)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.sendEmailToProfile(NotificationManager.java:1122)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.lambda$sendEmail$0(NotificationManager.java:1034)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.lang.Thread.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | Caused by: java.net.SocketTimeoutException: Connect timed out
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at java.base/java.net.Socket.connect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:357)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2175)
INFO   | jvm 1    | 2025/12/19 19:27:13 | 	... 18 common frames omitted
``

That's a pretty basic firewall error. (Or a service account without network privileges.)

The test from the gateway UI is ok, and the ignition module execute on the same gateway, firewall is off...

very stange, if I compare the sequencewhen the mail is send from the module:

INFO   | jvm 1    | 2025/12/19 19:47:36 | DEBUG: setDebug: JavaMail version 1.6.2
INFO   | jvm 1    | 2025/12/19 19:47:36 | DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
INFO   | jvm 1    | 2025/12/19 19:47:36 | DEBUG SMTP: need username and password for authentication
INFO   | jvm 1    | 2025/12/19 19:47:36 | DEBUG SMTP: protocolConnect returning false, host=mail.smtp2go.com, user=*******, password=<null>
INFO   | jvm 1    | 2025/12/19 19:47:36 | DEBUG SMTP: useEhlo true, useAuth true
INFO   | jvm 1    | 2025/12/19 19:47:36 | DEBUG SMTP: trying to connect to host "mail.smtp2go.com", port 25, isSSL false
INFO   | jvm 1    | 2025/12/19 19:47:36 | E [c.b.i.g.a.NotificationManager ] [19:47:36.440]: sendEmailToProfile() - Exception :  
INFO   | jvm 1    | 2025/12/19 19:47:36 | com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.smtp2go.com, 25; timeout 60
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at javax.mail.Service.connect(Service.java:388)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at javax.mail.Service.connect(Service.java:246)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at javax.mail.Service.connect(Service.java:195)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at javax.mail.Transport.send0(Transport.java:254)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at javax.mail.Transport.send(Transport.java:124)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendMailWithRetries(AbstractSmtpEmailProfile.java:289)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.doSendEmail(AbstractSmtpEmailProfile.java:259)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.inductiveautomation.ignition.gateway.mail.smtp.AbstractSmtpEmailProfile.sendEmail(AbstractSmtpEmailProfile.java:72)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.inductiveautomation.ignition.gateway.mail.EmailProfileManagerImpl$RunningEmailProfile.sendEmail(EmailProfileManagerImpl.java:455)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.sendEmailToProfile(NotificationManager.java:1122)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.bouyguesenergiesservices.ignition.gateway.alarmnotification.NotificationManager.lambda$sendEmail$0(NotificationManager.java:1034)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.lang.Thread.run(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | Caused by: java.net.SocketTimeoutException: Connect timed out
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at java.base/java.net.Socket.connect(Unknown Source)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:357)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
INFO   | jvm 1    | 2025/12/19 19:47:36 | 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2175)

and from the gateway

INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG: setDebug: JavaMail version 1.6.2
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: need username and password for authentication
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: protocolConnect returning false, host=mail.smtp2go.com, user=****, password=<null>
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: useEhlo true, useAuth true
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: trying to connect to host "mail.smtp2go.com", port 25, isSSL false
INFO   | jvm 1    | 2025/12/19 19:44:40 | 220 mail.smtp2go.com ESMTP Exim 4.98.1-S2G Fri, 19 Dec 2025 18:44:40 +0000
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: connected to host "mail.smtp2go.com", port: 25
INFO   | jvm 1    | 2025/12/19 19:44:40 | EHLO ENR-GTC
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-mail.smtp2go.com Hello ENR-GTC [77.62.202.212]
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-SIZE 52428800
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-LIMITS MAILMAX=5000 RCPTMAX=50000
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-8BITMIME
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-DSN
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-PIPELINING
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-PIPECONNECT
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-AUTH CRAM-MD5 PLAIN LOGIN
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-CHUNKING
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-STARTTLS
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250-PRDR
INFO   | jvm 1    | 2025/12/19 19:44:40 | 250 HELP
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "SIZE", arg "52428800"
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "LIMITS", arg "MAILMAX=5000 RCPTMAX=50000"
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "8BITMIME", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "DSN", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "PIPELINING", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "PIPECONNECT", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "AUTH", arg "CRAM-MD5 PLAIN LOGIN"
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "CHUNKING", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "STARTTLS", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "PRDR", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | DEBUG SMTP: Found extension "HELP", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:40 | STARTTLS
INFO   | jvm 1    | 2025/12/19 19:44:40 | 220 TLS go ahead
INFO   | jvm 1    | 2025/12/19 19:44:41 | EHLO ENR-GTC
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-mail.smtp2go.com Hello ENR-GTC [77.62.202.212]
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-SIZE 52428800
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-LIMITS MAILMAX=5000 RCPTMAX=50000
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-8BITMIME
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-DSN
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-PIPELINING
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-PIPECONNECT
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-AUTH CRAM-MD5 PLAIN LOGIN
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-CHUNKING
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250-PRDR
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250 HELP
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "SIZE", arg "52428800"
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "LIMITS", arg "MAILMAX=5000 RCPTMAX=50000"
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "8BITMIME", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "DSN", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "PIPELINING", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "PIPECONNECT", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "AUTH", arg "CRAM-MD5 PLAIN LOGIN"
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "CHUNKING", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "PRDR", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Found extension "HELP", arg ""
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: protocolConnect login, host=mail.smtp2go.com, user=*******, password=<non-null>
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: Using mechanism LOGIN
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: AUTH LOGIN command trace suppressed
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: AUTH LOGIN succeeded
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: use8bit false
INFO   | jvm 1    | 2025/12/19 19:44:41 | MAIL FROM:<***>
INFO   | jvm 1    | 2025/12/19 19:44:41 | 250 sender ok.
INFO   | jvm 1    | 2025/12/19 19:44:41 | DEBUG SMTP: sendPartial set
INFO   | jvm 1    | 2025/12/19 19:44:41 | RCPT TO:<***>
INFO   | jvm 1    | 2025/12/19 19:44:42 | 250 Accepted <***>
INFO   | jvm 1    | 2025/12/19 19:44:42 | DEBUG SMTP: Verified Addresses
INFO   | jvm 1    | 2025/12/19 19:44:42 | DEBUG SMTP:   ***
INFO   | jvm 1    | 2025/12/19 19:44:42 | DATA
INFO   | jvm 1    | 2025/12/19 19:44:42 | 354 Enter message, ending with "." on a line by itself
INFO   | jvm 1    | 2025/12/19 19:44:42 | Date: Fri, 19 Dec 2025 19:44:40 +0100 (CET)
INFO   | jvm 1    | 2025/12/19 19:44:42 | From: ***
INFO   | jvm 1    | 2025/12/19 19:44:42 | Reply-To: ***
INFO   | jvm 1    | 2025/12/19 19:44:42 | To: ***
INFO   | jvm 1    | 2025/12/19 19:44:42 | Message-ID: <***>
INFO   | jvm 1    | 2025/12/19 19:44:42 | Subject: Test Email
INFO   | jvm 1    | 2025/12/19 19:44:42 | MIME-Version: 1.0
INFO   | jvm 1    | 2025/12/19 19:44:42 | Content-Type: text/plain; charset=utf-8
INFO   | jvm 1    | 2025/12/19 19:44:42 | Content-Transfer-Encoding: 7bit
INFO   | jvm 1    | 2025/12/19 19:44:42 | X-Priority: 3
INFO   | jvm 1    | 2025/12/19 19:44:42 | 
INFO   | jvm 1    | 2025/12/19 19:44:42 | Test Email
INFO   | jvm 1    | 2025/12/19 19:44:42 | .
INFO   | jvm 1    | 2025/12/19 19:44:42 | 250 OK id=1vWfT0-FnQW0hQ0iyu-GxDf
INFO   | jvm 1    | 2025/12/19 19:44:42 | DEBUG SMTP: message successfully delivered to mail server
INFO   | jvm 1    | 2025/12/19 19:44:42 | QUIT
INFO   | jvm 1    | 2025/12/19 19:44:42 | 221 mail.smtp2go.com closing connection

....seems to be a thread context issue

I replaced

emailExecutorSend.execute(() -> {
    sendEmailToProfile(subject,message, listeEmail, listeUser);
});

with

gatewayContext.getExecutionManager().executeOnce(
        () -> sendEmailToProfile(subject,message, listeEmail, listeUser)
);

but I still have the connection issue
As a side note, my gateway has only one IP address

Comparing Wireshark captures might be interesting.

InetAddress addr = InetAddress.getByName("mail.smtp2go.com");
logger.info("SMTP IP = " + addr.getHostAddress());

print a reachable IP Address...

I will see if I can install wireshark...

The error isn't saying it's an unreachable address, it's saying the connect() operation timed out.

Usually that translates to a TCP SYN packet with no answer.

I disabled IPv6,

perhaps
wrapper.java.additional=-Djava.net.preferIPv4Stack=true
will help ?

Not sure I can install wireshark :frowning:

What value? any why is something called "retryDelaySec" being used for the timeout?

value is set to 60

That's 60 milliseconds.

something go wrong when I change from gatewayContext.getSmtpManager().sendEmail

I set it to 10000, I don't have the tcp exception, I will check if the mail is received !

Yes, Good Shot erronous parameter name with a two small value...