0 votes

I have your mail.dll.
It's possible to obtain mailbox size with imap or pop connection ?
You have an example ?

by

1 Answer

0 votes

In IMAP it depends on IMAP server supporting GETQUOTA command. Not all servers support it, you can check which extensions remote server supports by using Imap.SupportedExtensions method.

Quota quota = imap.GetQuota("");

long current = quota.Storage.Current;
Assert.AreEqual(15728640, quota.Storage.Maximum);

// you can also iterate over quota.Limits directly:
Assert.AreEqual("STORAGE", quota.Limits[0].Name);
long current = quota.Limits[0].Current;
Assert.AreEqual(15728640, quota.Limits[0].Maximum);

In POP3 you can use Pop3.GetAccountStat:

AccountStats stats = pop3.GetAccountStat();
Assert.AreEqual(2, stats.MessageCount);
Assert.Greater(stats.MailboxSize, 0);
by (301k points)
...