Dear ASPOSE,
I have a service which verify each minute my mailbox (internal mailbox for our company) if there is a non flaged email since three day. If there is, it fetchs and it puts a flag on the new mail.
I’ve started this service on a good windows SERVER 2012 R2 with 2G ram, at 6:18pm. But this morning, I saw that there is this OutOfMemory error which is repeated (of cours each minute) since 6am :
> Une exception de type 'System.OutOfMemoryException' a été levée.
> à #=qTynLNR7lusKCwHmg69FHL67FoAnHtPDovmsLKfE$QxDQYwHrOs9PcCTVJo2UFX62.#=qY0I$BEG6kpGkqwLqtRdppCQrJtSuCVFEvNmgZh7NnlU=(String #=qaCm62e53yHOL$OHaQMX9cQ==, Int32 #=qabsbelbwz8pOHWHme1CVfQ==)
> à #=qCwhieg2Kx_FtZMdR32v19dHCPpFoJlrlmDhwM0P8RnukOfEE8ZoIT9heSz$PLgiG.#=qkj59OF14v8Te34V2SPRKvw==(Int32 #=qarDyfZt0bZalTZSKf2MqAA==)
> à #=qCwhieg2Kx_FtZMdR32v19dHCPpFoJlrlmDhwM0P8RnukOfEE8ZoIT9heSz$PLgiG.#=q2rRJZkANBPReD1$xVSXb8Q==()
> à Aspose.Email.Clients.Imap.ImapClient.ListMessages(MailQuery query, Int32 maxNumberOfMessages)
> à Aspose.Email.Clients.Imap.ImapClient.ListMessages(MailQuery query)
> à XXX.FetchUnreadSupportEmail(String host, Int32 port, String username, String password, String libraryRootPath, Int32 maxFileLength)
> à InfosServeurs.Scheduler.ServiceScheduler.ProcessTasks(Settings settings, DateTime currentDate)
> à InfosServeurs.Scheduler.ServiceScheduler.Treat()
> Une exception de type 'System.OutOfMemoryException' a été levée.
> à #=qTynLNR7lusKCwHmg69FHL67FoAnHtPDovmsLKfE$QxDQYwHrOs9PcCTVJo2UFX62.#=qdkZtDsX4$R2fB9jdWxTY1ismRMmFIRgZ_E44ctvso4s=(String #=qaCm62e53yHOL$OHaQMX9cQ==, Int32 #=qabsbelbwz8pOHWHme1CVfQ==)
> à #=qTynLNR7lusKCwHmg69FHL67FoAnHtPDovmsLKfE$QxDQYwHrOs9PcCTVJo2UFX62.#=qcW7kqa8dG3oXpjCQ$hdNW5S_b5TU11kOUH6wB448vRc=.#=q9LAtpy1OBeE77ZMfuIPBkv_Hx4NrcKlBOe16uIavK8KFHhxYsB3FUQeKmpCERlE$(Object #=qzffE0XQ0hIe_2760Pi4BAw==)
> Une exception de type 'System.OutOfMemoryException' a été levée.
> à System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark& stackMark)
> à System.Threading.Thread.Start(StackCrawlMark& stackMark)
> à System.Threading.Thread.Start()
I put here my checking code which is written by your help (FetchUnreadSupportEmail function):
using (TransactionScope scope = new TransactionScope())
{
ImapClient client = new ImapClient(host, port, username, password);
ImapQueryBuilder builder = new ImapQueryBuilder();
//Put interval (Get only messages for today)
builder.InternalDate.BeforeOrEqual(DateTime.Now);
builder.InternalDate.Since(DateTime.Today.AddDays(-3));
//Read messages with no flag
builder.HasNoFlags(ImapMessageFlags.Flagged);
MailQuery query = builder.GetQuery();
ImapMessageInfoCollection coll = client.ListMessages(query);
Console.WriteLine(coll.Count + " new emails for today and not flagged! at " + DateTime.Now.ToString());...
Thanks for you help,
Best regards,
Alireza