We are using Mail.dll components for downloading mails from POP3 mailbox. We are using the below code snippet for the purpose:
Pop3 pop3 = new POP3
AccountStats stat = pop3.GetAccountStat
For (int mailId = 1 ; mailId <= stat.MessageCount; mailId ++)
String messageContent = pop3.GetMessageByNumber(mailId)
//do Something with the Mail
With the above logic, all the emails will be deleted from POP3 server, only after all the emails have been downloaded.
This at cases is not very convenient, say for e.g. We have lost connectivity to POP3 for a day & POP3 mailbox is full. The next day connection is restored and we start downloading mails.
Now no user will be able to send new emails(as Mailbox is full) unless we have finished downloading of all the emails (deleting the emails).
Is there a better approach which can be designed to avoid such issue. Could this be a solution: download one email and then delete the email from server (not just mark it for deletion)?
Please suggest the best solution which can be made using Mail.dll APIs. Thanks!