Created 02-25-2026 02:57 AM
Hello everyone,
I have been trying to solve an issue on my on-prem NiFi 2.4.0 application for a month which being PutEmail timeout errors. Specifically, we were using NiFi 1.9.0 and local smtp server to send mails, after updating to 2.4.0 we started using office365 smtp server.
swaks --server smtp.office365.com --port 587 --tls --helo test.local --auth LOGIN --auth-user notifymail@****.com --auth-password '****' --from notifymail@****.com --to okan.ergun@****.com --header "Subject: Test Email" --body "Test SMTP Relay Service"
With the command above I never had timeouts, and every mail was successful from the application environment, although NiFi gets timeouts time to time and doesn't have any specific times to have timeouts.
Processor Details:
SMTP Hostname | smtp.office365.com |
SMTP Port | 587 |
Authorization Mode | Use Password |
SMTP Username | notifymail@****.com |
SMTP Password | Sensitive value set |
SMTP Auth | true |
SMTP STARTTLS | true |
SMTP Socket Factory | ${literal('')} |
SMTP X-Mailer Header | NiFi |
Attributes to Send as Headers (Regex) | No value set |
Content Type | text/plain |
From | notifymail@****.com |
To | okan.ergun@****.com |
CC | No value set |
BCC | No value set |
Reply-To | No value set |
Subject | Test from NiFi |
Message | Test |
Flow file content as message | false |
Input Character Set | UTF-8 |
Attach File | true |
Include All Attributes In Message | false |
PutEmail[id=99041462-0dcf-31ed-e46c-45b560f51973] Failed to send email for FlowFile[filename=48b2d732-915c-4a3e-a5d4-a1c0cdcb1e7c]: Couldn't connect to host, port: smtp.office365.com, 587; timeout -1; routing to failure: org.eclipse.angus.mail.util.MailConnectException: Couldn't connect to host, port: smtp.office365.com, 587; timeout -1;
nested exception is:
java.net.ConnectException: Connection timed out
- Caused by: java.net.ConnectException: Connection timed out
Thank you for responding before-hand, I would appreciate any criticism also.
Created 02-26-2026 06:50 PM
@okanergun Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @MattWho @mburgess who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 03-03-2026 03:11 PM
Hello @okanergun,
According to https://issues.apache.org/jira/browse/NIFI-8630 the PutEmail processor was updated as mentioned here:
"Upgraded javax.mail 1.4.7 to jakarta.mail 2.0.1 for PutEmail"
That was on 1.14.0, so in your case, you were using the old javax.mail and not the new jakarta.mail.
There is a difference on the environment to take in consideration.
The log you shared shows this:
Couldn't connect to host, port: smtp.office365.com, 587; timeout -1This means you do not have a socket timeout defines, which could case the processor to hang and report those timeouts when OS tells so.
You can try to add these setting:
-Dmail.smtp.connectiontimeout=30000
-Dmail.smtp.timeout=30000
-Dmail.smtp.writetimeout=30000
https://eclipse-ee4j.github.io/angus-mail/docs/api/org.eclipse.angus.mail/org/eclipse/angus/mail/smt...
Also, make sure you have "Concurrent Tasks" under the PutEmail processor set to 1.
This kind of SMTP for Microsoft may block parallel connections.
Created 03-10-2026 07:43 PM
@okanergun Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks.
Regards,
Diana Torres,