+1 vote

Hi,

We are trying to process mails from mailbox using POP3.
When mail is saved physically then we delete it from server.
Now sometimes we get error like "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host".

So the processed mail was not deleted from server(Due to Close() method not called), we get same mail again.

So my concern is only with to how handle this scenario.

Thanks in advance.

by

1 Answer

0 votes

I'd say the best solution would be to compute a checksum over message bytes (eml returned by Pop3.GetMessage) and ignore checksums that were already processed.

You can also relay on uids beeing unique, however there is a chance that server re-assigns uid after message deletion:

The server should never reuse an unique-id in a given maildrop

Here are more info on Unique IDs in POP3 protocol:
https://www.limilabs.com/blog/unique-id-in-pop3-protocol

by (297k points)
...