Closed tstavinoha closed 7 years ago
Hello,
Are you able to create and share a test case which reproduce your issue ?
Ok, I created a small test to display this behavior. Unfortunately, this potential bug does not occur with dumbster or greenmail, but rather with some standalone dummy clients and Microsoft Exchange that are not easy/possible to start just for testing purposes. Therefore, I have used the 'free' Mailtrap service (credentials included in test, throwaway account) since it seems to be the easiest approach, and also suffers from the given problem - no mail in inbox until connection closed.
You can use breakpoints to pace the execution and make sure it waits for connection closing.
Br!
Thanks, I will look at your test.
Unfortunately I do not reproduce the issue using your test case.
I have even updated org.nlab.smtp.FlushOnlyAfterCloseTest#sendEmail to:
Assert.assertEquals(0, getInboxCount());
transport.sendMessage(mimeMessage);
Assert.assertEquals(1, getInboxCount());
And the test is successful after removing the Assert.assertEquals(0, getInboxCount());
after the CompletableFuture.runAsync(this::sendEmail).join();
.
Could you create the SmtpConnectionFactory with the debug enabled and paste the log?
Properties props = new Properties();
props.put("mail.debug", "true");
SmtpConnectionFactory connectionFactory = SmtpConnectionFactoryBuilder
.newSmtpBuilder()
.host("mailtrap.io")
.port(25)
.protocol("smtp")
.username("ca83413abb171c")
.password("3ebe29d15ef77c")
.session(props)
.build();
Your initial logs are strange, especially the reset while you are sending an email: 11:04:59 AM - Client: RSET
.
Maybe it relates to this serverfault question ?
Interesting.. We do use Symantec at work. I will try it out tomorrow on a Linux environment and get back to you. Thanks for the link!
I have disabled Symantec and everything started working! I don't think I would ever caught on to that without your help, Nicolas, so thank you very much! Closing this
You're welcome!
I'm integrating this library to manage the SMTP connection pool in a multi-threaded environment. As far as I've seen, the library handles parallel connections well and reuses connections when possible.
However, I've noticed that the messages are not completely sent until I close or clear the pool. I've tried using both the local dummy smtp server, and our production mail server.
So, dummy mail logs show something like this:
This is where it stops. Then, when I close the pool, the following logs are displayed:
Everything works ok with vanilla, connection-per-message workflow. I've configured the pool as shown in README and send the messages using try with resources.
Any idea what could be wrong? Thanks