We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Basic listing of email in gmail sent folder not working


The following code doesn’t seem to work - the TotalMessageCount is zero. Strangely though the client.ListMessages takes about 5 minutes to come back with an empty list. I have logged onto gmail and it definitely has emails in the “Sent Mail” folder. Any ideas?

client = new ImapClient(tbServer.Text, Convert.ToInt32(tbPort.Text), tbUser.Text, tbPassword.Text);
client.EnableSsl = true;
var folderInfo = client.ListFolder("[Gmail]/Sent Mail");
var msgCount = folderInfo.TotalMessageCount;
var msgList = client.ListMessages();

Hi Paul,

Thank you for sharing your issue with us.

It seems that you are using an old version of Aspose.Email for .NET that uses properties and methods such as EnableSsl and Connect. These have been marked as deprecated in our latest versions and you don’t need to use these. Please download the latest version of Aspose.Email for .NET 4.6.0 and use the following sample code which works fine at my end. If you still feel issue, please feel free to contact us for further assistance in this regard.

Sample Code:

ImapClient client = new ImapClient(“[imap.gmail.com](http://imap.gmail.com/)”, 993, “kashif.iqbal”, “password”);

client.SecurityOptions = SecurityOptions.Auto;

client.SelectFolder("[Gmail]/Sent Mail");

var folderInfo = client.ListFolder("[Gmail]/Sent Mail");


var messageInfoCol = client.ListMessages();

foreach (var messageInfo in messageInfoCol)


var subject = messageInfo.Subject;