Docker network to mail server unstable

I have a spring boot app that runs docker container on top of Linux.
The app is sending bulk email to internal employees.
We have around 10 thousand emails to be sent every night.
Each email took about 5ms to sent.
The mail server and docker spring is in same company network

The problem is, the mail application in docker sometimes cannot connect to mail server.

Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: xxx.xxx.xxx, port: 25, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: xxx.xxx.xxx, port: 25, response: -1

But if I run the spring boot application without docker, from same machine, everything works fine (all emails were sent and no error message logged)

The docker network seems unstable.

Is this needs tuning or something?
This is my dockerfile to create the container

FROM openjdk:11-jre-stretch	
COPY cacerts /docker-java-home/lib/security
RUN mkdir conf
VOLUME /tmp
EXPOSE 8002
ARG JAR_FILE=build/libs/mailman-1.1.jar
ADD ${JAR_FILE} mailman.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/mailman.jar"]

Is this issue resolved??. I am getting the same issue. If you have solved the issue. Can you help me in this.