Mail connection resets

Hello,

I am having trouble with a piece of Java software I wrote. It's using the Mail package. The basic algorithm is:

0. connect to a pop3 email account

1. read in an email attachment

2. do some calculations

3. delete the email and close the email connection

My program keeps failing at #3 when it tries to delete the email. Here's the exception:

Caused by: javax.mail.MessagingException: Exception deleting messages during clo

se;

nested exception is:

java.net.SocketException: Connection reset

at com.sun.mail.pop3.POP3Folder.close(POP3Folder.java:216)

at org.fstrf.common.siteRegLoader.EmailServices.close(EmailServices.java

:264)

... 2 more

There's typically about 2 minutes between step 0 and step 3. I'm not at all familiar with email servers, spam filters, firewalls, etc. What can be causing this exception? I'm not sure how to even begin an investigation.

TIA.

[979 byte] By [javaJockey24a] at [2007-11-26 13:36:47]
# 1
It takes 2 minutes to fail or 2 minutes before you start doing 3?If the second then one reason is because you are taking too long before doing something on the connection, so the server is closing it.
jschella at 2007-7-7 22:22:42 > top of Java-index,Core,Core APIs...