Archived Forum Post

Index of archived forum posts

Question:

CopyMail Out-of-Memory for Extremely Large Mailboxes

Sep 05 '12 at 18:52

The CopyMail function copies all e-mails in to local memory. However when the mailbox is larger than aprox. 14000 e-mails, then it reaches c#'s upper memory limit. What can be done?


Answer

The CopyMail method should not be used for extremely large mailboxes. Instead, your application should download emails individually so that it may process each email, discard it, and continue without accumulating all emails in memory at once. In addition, if a failure occurs, your application has more options for resuming rather than re-starting from the very beginning.

Here is an example showing how to download emails by message numbers:

ASP: Read All Email from POP3 Inbox by Message Numbers

SQL Server: Read All Email from POP3 Inbox by Message Numbers

C#: Read All Email from POP3 Inbox by Message Numbers

C++: Read All Email from POP3 Inbox by Message Numbers

Unicode C++: Read All Email from POP3 Inbox by Message Numbers

Objective-C: Read All Email from POP3 Inbox by Message Numbers

IOS: Read All Email from POP3 Inbox by Message Numbers

PowerShell: Read All Email from POP3 Inbox by Message Numbers

MFC: Read All Email from POP3 Inbox by Message Numbers

C: Read All Email from POP3 Inbox by Message Numbers

Unicode C: Read All Email from POP3 Inbox by Message Numbers

Delphi: Read All Email from POP3 Inbox by Message Numbers

DelphiDll: Read All Email from POP3 Inbox by Message Numbers

Visual FoxPro: Read All Email from POP3 Inbox by Message Numbers

Java: Read All Email from POP3 Inbox by Message Numbers

Androidâ„¢: Read All Email from POP3 Inbox by Message Numbers

Perl: Read All Email from POP3 Inbox by Message Numbers

PHP: Read All Email from POP3 Inbox by Message Numbers

PHP: Read All Email from POP3 Inbox by Message Numbers

Python: Read All Email from POP3 Inbox by Message Numbers

Ruby: Read All Email from POP3 Inbox by Message Numbers

VB.NET: Read All Email from POP3 Inbox by Message Numbers

Visual Basic: Read All Email from POP3 Inbox by Message Numbers

VBScript: Read All Email from POP3 Inbox by Message Numbers