Github user ijokarumawak commented on the issue: https://github.com/apache/nifi/pull/483 @trixpan I found why I got the `Too many connection` exception. I didn't setup SSL at ListenSMTP processor, so it was expecting plain text connections. But PutEmail uses `javax.net.ssl.SSLSocketFactory` by default, although it's configurable, I didn't. Then PutEmail tries to open SSL connection while ListenSMTP expects plain text. Then `javax.mail.SocketFetcher` fallbacks from SSL to Plain socket, as `mail.smtp.socketFactory.fallback` is set to [true](https://javamail.java.net/nonav/docs/api/com/sun/mail/smtp/package-summary.html). It opens SSL socket, and got an exception, then reopen plains socket. That's why I see two connection attempts on SMTP server side. I suspect there's a race condition between SMTPServer releasing the Semaphore and PutEmail requesting 2nd connection (fallback). After I changed `SMTP Socket Factory` to `javax.net.DefaultSocketFactory`, the error disappeared.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---