Aborting a Pop3 GetMailMessage operation

0 votes
asked Nov 25, 2010 by guest (120 points)
edited Apr 1, 2011

I'm trying to abort a Pop3 GetMailMessage operation but it just doesn't seem to work. I have the GetMailMessage running on a separate thread and from the application thread, i tried pop.Abort() when I click on a button and I see the message is downloading (I have a progress bar for that). The message keeps on downloading.

I also tried adding pop.Abort() in a function that handles the TransferProgress event. It does not work! Any advice?

    pop.TransferProgress += PopTransferProgress;

    private void PopTransferProgress(object sender, Pop3TransferProgressEventArgs e)
Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Nov 26, 2010 by Lukas Pokorny (128,250 points)
edited Nov 26, 2010

The Abort method doesn't abort the operation immediately, but only if it doesn't finish within the time interval specified by Pop3 object's AbortTimeout method (which is 3000 by default - 3 seconds). Unfortunately, this information is missing from Abort method's documentation.

If you wish to abort an operation immediately, simply call Pop3 object's Dispose method. The Pop3 instance won't be usable any more after this, but that would be the case for Abort method as well if the time specified by AbortTimeout actually elapsed. (Reason: The POP3 protocol doesn't support aborting message retrieval.)

commented Nov 26, 2010 by guest (120 points)
I have tried setting the AbortTimeout to 1000ms (which I understand is the minimum), but that didn't work either. Will try the Dispose method. Thank you.
commented Nov 26, 2010 by guest (120 points)
That did it, thank you again.
commented Dec 1, 2010 by Lukas Pokorny (128,250 points)
Further investigation revealed that you are right - there is a bug in the Pop3 object that causes the abort process not to work correctly because the flag set by Abort method is only checked when no data is available to be received. This will be fixed in the next release. Many thanks for bringing this to our attention!