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

**URL:** <https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920>\
**Category:** Module Development\
**Tags:** ignition81\
**Created:** [December 19, 2025, 6:14pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920 "2025-12-19T18:14:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 6:14pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/1 "2025-12-19T18:14:56Z")

</div>

**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 🧐

```python
(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

```python
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)

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/7/674207ca3bbe0e3c8e99df39551f7183b89d7055.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/f/1f82b0adfeaf05d9140db7a1a5cd80434548edea.png)

```python
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
``
```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 19, 2025, 6:32pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/2 "2025-12-19T18:32:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 6:36pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/3 "2025-12-19T18:36:25Z")

</div>

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:

```python
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

```python
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

```

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 6:58pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/4 "2025-12-19T18:58:17Z")

</div>

....seems to be a thread context issue

I replaced

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

```

with

```python
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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 19, 2025, 7:11pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/5 "2025-12-19T19:11:16Z")

</div>

Comparing Wireshark captures might be interesting.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 7:20pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/6 "2025-12-19T19:20:53Z")

</div>

InetAddress addr = InetAddress.getByName("[mail.smtp2go.com](http://mail.smtp2go.com)");  
logger.info("SMTP IP = " + addr.getHostAddress());

print a reachable IP Address...

I will see if I can install wireshark...

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 19, 2025, 7:23pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/7 "2025-12-19T19:23:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 7:30pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/8 "2025-12-19T19:30:16Z")

</div>

I disabled IPv6,

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

Not sure I can install wireshark ☹

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 7:40pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/9 "2025-12-19T19:40:10Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1db9b74be99368f28dbae72761fd853a75b1b5b8.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 19, 2025, 7:50pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/10 "2025-12-19T19:50:21Z")

</div>

> [@mazeyrat](#):
>
> `.setTimeout(this.email_retryDelaySec)`

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

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 8:01pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/11 "2025-12-19T20:01:05Z")

</div>

> [@mazeyrat](#):
>
> email\_retryDelaySec

value is set to 60

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 19, 2025, 8:01pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/12 "2025-12-19T20:01:34Z")

</div>

That's 60 milliseconds.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 19, 2025, 8:12pm UTC](https://forum.inductiveautomation.com/t/emailprofilemanager-send-email-com-sun-mail-util-mailconnectexception/112920/13 "2025-12-19T20:12:44Z")

</div>

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...
